Browse documentation

Задеплойте своего первого бота Discord

Run a slash command in a test server using discord.js, discord.py or JDA. Trace the path from project files to a working /ping reply.

Choose a runtime and get the example

Open Хостинг ботов Discord, choose a runtime, and sign in. Match the runtime to the code you want to maintain. The create form shows which plans can run it. Choose Начать с примера if you want to follow this walkthrough. If your bot also serves a web app, use the Discord dashboard guide.

  • пример на discord.js uses index.js and declares its dependency in package.json.
  • discord.py example uses main.py и requirements.txt.
  • пример на JDA includes Java source and a Gradle build. Extract the archive on a machine with Java 21 and Gradle 8.14.3. In the directory containing build.gradle, run gradle shadowJar. Upload the resulting bot.jar.

For the script examples, upload the project to the deployment root in Files. Check that the entry file and dependency list appear together. If you already have a repository, follow GitHub push deployments.

Connect a Discord application

In the Discord Developer Portal, create an application or open the one for your bot. On the Bot page, obtain its token. Open Variables in your deployment and save it as BOT_TOKEN. The starter reads that variable when it logs in. Keep its value out of your project and screenshots.

Install the application in a server where you can manage applications. Give the installation the bot и applications.commands scopes. The sample handles slash commands and needs no message-content intent. Open Discord Developer Portal.

Start the process and try /ping

  1. Start the deployment and open Console. Resolve any missing entry file or dependency before testing in Discord.
  2. If Console reports a login error, check BOT_TOKEN in Variables and restart. If it reports a command registration error, check the application’s installation in your test server.
  3. In your test server, type /ping, select this application’s command, and send it. The expected response is pong.

Verify a change or rotate a token

Change the reply text locally, then upload the changed file and restart, or deploy the connected branch. Run the command again. A changed reply verifies which version handled the interaction. If another instance on your laptop uses the same token, stop it before the test.

After resetting a token at Discord, save its replacement in Variables and restart the deployment. Check the first login message before reinstalling the application. If login succeeds but the test fails, use the руководства по пропавшим слэш-командам.