Building a Discord Chatbot with Python (8) - Adding Options to Bot Commands
Continuing from our last session, we’ll be using discord.ext.commands
to add options to our chatbot commands.
(Reference: Documentation)
We’ll add a new ‘category’ option to the ‘quiz’ feature, allowing for quizzes in various categories.
Additionally, we’ll introduce a ’timeout’ option to adjust the time limit for answering questions.
Recap
In our previous article, we refactored the code using discord.py
’s extension, discord.ext.commands
.
The code for the ‘quiz’ feature, found in commands/quiz.py
, is as follows: