/ping command. This is a code template: the code is yours, open and editable, and Vertra Cloud runs what is in src/.
What it creates
One app (code) on the JavaScript runtime, with no web address: the bot only makes outgoing connections. It needs at least 100 MB of memory (256 MB recommended) and no image slot, so any plan can run it. See What are templates.- It logs in with the bot token, registers the
/pingslash command on every start and answers with the gateway latency. - It uses only the
Guildsintent, so there is no privileged intent to turn on. - With no token or a wrong token the process exits with code 1 and a clear message in the app log.
- Source in
src/index.js; dependencies insrc/package.json.
What the wizard asks
First steps
1
Create the bot and get the token
In the Discord Developer Portal create a New Application, open Bot and click Reset Token. Copy the value: it is shown only once.
2
Paste it in the wizard
Paste the token when the wizard asks. It is stored encrypted and never goes in the code.
3
Invite the bot
In OAuth2 > URL Generator tick the scopes
bot and applications.commands, open the generated URL and choose your server.4
Check
After the deploy the app log shows
Logged in as <bot name>. In Discord, type /ping: the bot answers Pong! with the latency. The global command can take a few minutes to appear the first time.Make it your own
Opensrc/index.js, add your commands and deploy again, or restart if you edited in the app’s editor. To add libraries, run npm install <package> locally and ship the updated package.json and package-lock.json: the platform installs dependencies on every deploy.
Editing the code detaches the app from the template, so it stops receiving new versions of it. See Update and roll back.
Reference
Limits and common problems
- Two copies with the same token would answer twice, so zero-downtime deploy is off.
- The minimum is 100 MB, and 256 MB (the recommended size) is enough for a simple bot. A bot on many servers or with a large cache needs more; you can raise the memory.
- Discord global commands are slow to propagate. For tests, register guild commands in your code.
Login failedin the log.DISCORD_TOKENis not the bot token. Reset it in the Portal, update the variable and restart./pingdoes not show up. Wait a few minutes and check that the invite had theapplications.commandsscope.- The app does not stay up. Without a valid token the process exits with code 1. Fix the token and restart.