Commands
!ping
→ Pong!!roll [sides]
→ roll a die (default 6)!addtodo <text>
/!listtodos
/!cleartodos
I built this to practice Python events. I also learned to keep secrets in .env
.
- Create a bot in Discord Developer Portal and enable Message Content Intent.
- Create
.env
from.env.example
with your token (do not commit.env
). python -m pip install -r requirements.txt python bot.py
- Enabling intents or commands won’t work
- Loading secrets from
.env
(dotenv) - Simple command handling + JSON storage
- Commands handled by
discord.ext.commands.Bot
with prefix!
. - Per-server TODOs saved in
todos.json
(keyed by guild ID, ignored by Git). - Secrets come from
.env
viapython-dotenv
.
. ├─ bot.py # commands + JSON TODO storage ├─ requirements.txt # deps ├─ .env.example # token template └─ LICENSE
KeyError: DISCORD_TOKEN
→ create.env
from.env.example
and paste your token.- Bot doesn’t respond → enable Message Content Intent in the Developer Portal.
- Windows: use
python -m pip install -r requirements.txt
thenpython bot.py
.
MIT — see LICENSE.