Skip to content

Latest commit

 

History

History

DiscordBot

Creating a Discord Bot in Python

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.

Warm-Up: Chat Bots

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.

Warm-Up 2: Review

Facilitate the Collections Review Blooket. These concepts will be helpful to review for the code-along activity.

Lecture: New Python Concepts

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.

Code-Along: Discord Chat Bot

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.

Discord Server

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.

Challenges

The challenges task students with extending the Discord bot's capabilities, including adding commands to control the bot's behavior.

Agenda

Activity Time
Warm-Up PowerPoint 10m
Warm-Up Review 10m
PowerPoint 15m
Break 10m
Code-Along 30m
Challenges 45m