A simple discord bot template for the bohr.io platform. It uses API endpoints to respond to Interactions with the bot.
-
In the bohr.io platform start a new project with this template.
-
Create a Discord application and a bot.
-
Generate a url in the OAuth2/Url Generator, with the options:
-
Invite the bot to your server using the generated url.
-
Set the following environment variables on the bohr.io project settings:
-
From your Discord Application General Information page:
APPLICATION_ID
DISCORD_PUBLIC_KEY
-
From your Discord Application Bot page.
DISCORD_BOT_TOKEN
-
From your Discord Client (enable the 'developer mode' under advanced settings. Then right click on your test server)
TEST_GUILD_ID
-
-
Create a second Discord application to be your development application.
-
Start the project locally using the terminal commands:
git clone <PROJECT_REPOSITORY_URL> cd <REPOSITORY_NAME> npx -y bohr@latest dev
-
When starting your project locally, a tunnel url to your local project will be provided. Use it for the
INTERACTIONS ENDPOINT URL
in the development application.
To update the bot commands use the project's endpoint /update-commands
.
This endpoint can receive the global
query parameter. When set to 'true'
, it updates global bot commands. Otherwise, it only updates commands for the TEST_GUILD_ID
server.
- server: send the channel and server that the user is in
- user: send a mention to the user