Chapter III: Late Registration¶
If you know anything about Discord bot development, you probably expected this guide to start here. Surprise?
Before 3515.games can do anything useful, you'll need to create an application for it on the Discord Developer Portal.
Prerequisites¶
Before proceeding, make sure you have the following:
Creating Your Application¶
Head to the Discord Developer Portal and click the New Application button in the top-right. Give your application a name (it doesn't matter what it is), agree to the terms, and click Create.
Note the application ID. Copy it, then open a terminal and run:
- Replace
{APP_ID}
with your application's ID.
Getting a Token¶
Head over to the Bot tab of your application's page and click Add Bot. Confirm the action and your application will have a cool new bot attached to it. You can change the bot's username and avatar here, but that's not important right now.
What is important is that "View Token" button, just below your bot's username. The long string of characters revealed when you click it is your bot's token.
Keep this a secret to everybody
Never share your bot's token with anyone. Anyone who has your bot's token has full control over your bot.
If you token is lost or compromised, you'll have to generate a new one, and your bot will stop working until you update the token in its code.
Copy your token to your clipboard, then head back to your terminal and run:
- Replace
{TOKEN}
with your bot's token.
Inviting Your Bot¶
Paste the following URL into your browser: (1)
- Replace
{APP_ID}
with your application's ID. Do not change anything else.
https://discord.com/api/oauth2/authorize?client_id={APP_ID}&permissions=326484094224&scope=bot%20applications.commands
Follow the prompts to invite your bot to any server where you have the appropriate permissions.
Running 3515.games¶
Let's try that again, shall we?
-
Edit the
main
run configuration as follows:- Add an environment variable named
DOPPLER_ENV
with a value of1
- Check Emulate terminal in output console
- Add an environment variable named
-
In the Project tool window, right click on
bot/main.py
and select Run 'main'.
-
At the root of your project, create a
launch.json
file with the following contents: -
Open
bot/main.py
and press F5.
If everything worked, you should see something like this in your console:
It works. Awesome. Now you can head over to the Discord server you invited it to and start playing around with it.
But of course, you came here to learn how to self-host it. We're not there quite yet.
Bear with me for just a little longer.