Lazo Lab Sign up

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-here

Your turn

Set up the project folder and the DISCORD_TOKEN variable.

Watch a video on thisOpens YouTube search results for “Setting up the project” in a new tab

Quiz · +10 XP

Where should the bot token go?

Log in to save progress and earn XP.