Skip to content

Your first bot

By the end of this page your bot is online in a test server and answers /ping.

  1. Open the Discord Developer Portal and choose New Application.

  2. Go to Bot and press Reset Token. Copy the token and keep the page open. Treat the token like a password: anyone who has it controls your bot.

  1. In Makecord, choose New project, give the bot a name and pick a folder. The project starts with two commands, /ping and /greet, and a ready event.

  2. Press Open Secrets on the Get started tab, paste the token into DISCORD_TOKEN and save. The token is encrypted with your system keychain. It’s never written to the project folder, and you can’t view it again in the IDE.

  3. Press Create invite link on the Get started tab, or choose Run › Invite bot to a server. Makecord reads the bot’s ID from the token and ticks the permissions your blocks need, such as Manage Roles for Add Role. Open the link and pick a server you manage. If the project uses privileged intents, the dialog links straight to the page where you turn them on.

  4. Open makecord.json and add your test server’s ID as devGuildId. To find the ID, enable Developer Mode in Discord’s settings, then right-click the server and choose Copy Server ID.

    makecord.json
    {
    "specVersion": 1,
    "name": "My bot",
    "devGuildId": "123456789012345678",
    "intents": ["Guilds"]
    }

    With devGuildId set, slash commands register to that server only and show up instantly. Without it they register for every server, which can take a while to reach Discord clients.

Press Run in the toolbar. The Run panel shows the bot coming online:

19:42:07 ● Running My bot#4821 is online in 1 server
19:42:08 Registered 2 commands on the test server /greet /ping

Type /ping in your server. The bot replies with its latency, and in the editor the blocks it ran light up for a moment.