NEW 📢 Save up to 30% on your first month, limited time offer!

How to move your Discord bot to PlayNHost

Discord bot hostingUpdated Oct 6, 20263 min read

Moving a bot is mostly copying files and entering the same settings. Plan a few minutes when the bot can be offline.

Before you start

  • Make sure the bot's code and its data files (databases, config, saved state) are all in one folder you can copy.
  • Keep the old copy running until the new one works, but do not run both at once with the same token for long. Two copies logged in with one token fight each other, and commands may be answered twice or not at all.

Steps

  1. Pick the language. Open your server in the panel, go to Overview and click Edit Server Type if you need Python or Java. A new server starts as Node.js. Do this before uploading files. See How to change your server type or game version.
  2. Copy the files. Open Files and upload the folder, or give a git address in Game Settings. Large folders upload faster over SFTP: How to connect to your server files with SFTP. Leave out node_modules (Node) and virtual environment folders (Python), the server installs packages itself.
  3. Enter the settings. In Settings, then Game Settings, set the main file (or jar file) and the token. If your code reads the token from a config file, either leave the file as it is, or switch to reading DISCORD_TOKEN.
  4. Databases. If your bot used a database on the old host, see How to use databases with your server for the one included with your plan.
  5. Stop the old bot, then start the new one from the Console page and watch the console until the bot logs in.

If something does not work

  • A missing package or wrong file name shows in the console in the first seconds. See Why your Discord bot keeps stopping.
  • If the bot connects but cannot read its saved data, check that the data files were copied with the same folder structure.

CREATE YOUR GAME SERVER
READY TO GET STARTED?

Save up to 30% on your new game server.
Premium performance, instant activation, and unbeatable reliability all at a better price.

OUR LATEST BLOGS