You might be thinking, “Wow, it’s really possible to make a Discord bot from your phone?!”
The answer is yes… with some restrictions.
Today we’re going to go over mobile bot development and learn step by step how you can actually code your next Discord bot directly from your phone.
Before we get into the details, there is something I should mention upfront:
You will not be able to actually host your Discord bot from iOS (due to internal restrictions).
You will be able to host your Discord bot directly from Android. Android allows it.
If you are interested in hosting a Discord bot directly from your phone, this can be done using Termux and pm2. The only issue is, whenever your phone locks your bot will disconnect. This is why we recommend using the development method we’re recommending below to keep your bot up 24/7 and allow you to edit it directly from your mobile device. Win-win!
The Best Option for Discord Bot Development on Mobile
I’m not going to sugarcoat it — coding on mobile is going to be tougher than on a regular desktop/laptop machine. If you have a large device (like an iPad or Android tablet for example), that’ll make things much easier.
My recommended method for doing this on mobile is to host your code on a third-party server and then use an SSH (secure shell) client on iOS/Android to log in and manage your bot.
This has several benefits. For one, your bot will be up and running 24/7, and it won’t shut off whenever you lose service on your phone, or even when you get a lock screen (this can happen when hosting on Android).
Two, you’ll be able to access it on any device — all you’ll need is to download and install an SSH client.
Third-party hosting is the most practical and reliable way to make this happen, so that’s the path we’re going to go down.
To sum it up, we’re going to be:
(1) Hosting our bot on a third-party server
(2) Connecting to it from our phone via. SSH
(3) Modifying the bot through SSH and editing directly through a text editor.
(4) Starting our bot with node.js through the SSH client and watching it run!
Let’s walk through how this is done.
Setting Up Your Third-Party Hosting Server
The first thing you’ll want to do is actually set up your server.
For our purposes here, we’ll be using a third-party Virtual Private Server (VPS) to host our bot, and we’ll be connecting to this VPS for modifying our code, uploading bot files, etc. This is the best way to go, especially if you’re trying to develop a bot on iOS.
We’re going to follow along with this detailed guide on Discord Bot Hosting. It’ll tell you everything you need to know to get a VPS up and running.
The first thing you’ll do in that guide is set up a VPS account and deploy an “instance”.
Even though we’re using Node as an example, you could just as easily set up another code runtime environment (like Python or Java, for example) and edit your bot the same way from your mobile device.
Once your VPS is all set up and ready to go, we’ll talk about connecting to your VPS through SSH (Secure Shell) and modifying/editing your bot’s files!
Connecting to Your VPS On Mobile
You’re at a great point in time here.
You’ve set up your VPS (if you haven’t, go back to the previous section and follow along with the Discord bot hosting guide), and now you’re ready to connect to your VPS through your mobile device!
There are two ways you can do this (depending on if you’re using iOS or Android).
If you’re using iOS: Download the Textastic SSH Code Editor
If you’re using Android: Download the Termux Terminal Emulator
Once you’ve got an SSH Client installed on your device, pull up your VPS Server Information Page and grab your login info.
Log into your VPS from your mobile device, and you’re home free!
From here you can edit your bot’s files and send commands to turn your bot on, turn your bot off, etc.
Important Note: If you want the full scoop about how to get this all set up on your VPS, do a full read-through of our Discord bot hosting guide. It’ll give you the exact information you need to get this all set up and running for Node.js.
And that’s all there is to it. You’ve successfully set up a Virtual Private Server to run your bot 24/7, 365, and then you learned how to connect to and modify your bot’s files through your mobile device.
This is the most rock-solid way I’ve found of doing this; but as always, if you have any suggestions, feel free to leave a note/comment!
I wish you the best of luck on your “mobile-bot-coding” journey!