App 8: Build a Discord Bot / Build a Discord bot
Lesson 3 of 10
Setting up the project
Install discord.py in a virtual environment and store the token in an environment variable, never in your code.
Key points
- pip install discord.py
- export DISCORD_TOKEN=...
- Add .env to .gitignore
python3 -m venv venv
source venv/bin/activate
pip install discord.py
export DISCORD_TOKEN=paste-your-token-hereYour turn
Set up the project folder and the DISCORD_TOKEN variable.
Quiz · +10 XP
Where should the bot token go?
Log in to save progress and earn XP.