This lesson covers the programming concepts required to build a Discord bot in Python, including importing a 3rd party library, reading API documentation, and using decorators. The goal is to have a simple, working discord bot that students can add to a Discord server.
Present the Chat Bot Introduction PowerPoint Presentation. The PowerPoint contains a link to ChatGPT - if it is running, try to talk to it for a minute or two.
Facilitate the Collections Review Blooket. These concepts will be helpful to review for the code-along activity.
Present the New Topics PowerPoint Presentation. Review the presentation ahead of time, including the notes in the slides.
Make sure to cover each topic briefly - there will be more time to dive into specifics during the code-along. It is also less important for students to fully understand each topic - it is more important for them to be able to use these things to make bots.
The activity walks through the creation of a Discord bot, including registering the bot as a Discord application, adding the bot to the server, and making the bot respond to messages. This will use the concepts introduced in the PowerPoint, including using 3rd Party APIs and decorators.
Note: These code-along instructions are not password protected.
Before running through the code-along, make sure each student in the class has their own channel created in the Python 201 Sandbox server, under the "STUDENT CHANNELS" category.
Additionally, @everyone
should have the "Manage Server" permission - this will let students add their bots.
The challenges task students with extending the Discord bot's capabilities, including adding commands to control the bot's behavior.
Activity | Time |
---|---|
Warm-Up PowerPoint | 10m |
Warm-Up Review | 10m |
PowerPoint | 15m |
Break | 10m |
Code-Along | 30m |
Challenges | 45m |