By Kate Kiatsiri, Aaron Minnick, Anna Pittman, Jeff Terrell, Colt Thatcher, and Hannah Young
A Discord bot that provides various functionality to assist Epicodus students and instructors.
- C#
- .NET
- MySQL
- Entity Framework
- Discord.NET
This is a Discord bot utilizing the Discord.NET library. It provides a variety of functions to assist Epicodus students and instructors. Full feature list below.
- Navigate to the Discord Developer Portal
- Create a new application
- Give the application a name (this will be the bot's initial username)
- On the left-hand sidebar, under
Settings
, clickBot
- Click
Add Bot
- Confirm the popup
- Under
Token
(next to the bot's icon), clickCopy
. Keep this token handy for now
- Back on the Discord Developer Portal, click on your application
- On the left-hand sidebar, click
OAuth2
to expand the dropdown, and then selectURL Generator
- Under
Scopes
, selectbot
andapplications.commands
- Under
Bot Permissions
, selectAdministrator
(optional: or select only the permissions you need) - Navigate to the provided URL and follow the prompts to add your bot to the desired server
- Select
Authorize
- Download and install the .NET 5.0 SDK as required for your system. Be sure to add the .NET sdk to your PATH
- Use terminal to navigate to desired parent directory and use
git clone https://github.com/Corgibyte/epibot.git EpiBot.Solution
- Navigate into the project directory nested inside the .Solution directory:
cd EpiBot.Solution/EpiBot
- Create an appsettings.json file:
touch appsettings.json
- Edit the new appsettings.json file and add the following, making sure to replace the indicated sections with your MySQL user ID and password and your Discord Token generated above in
Generate bot tokens and permissions
: step 7
{
"ConnectionStrings": {
"DefaultConnection": "Server=localhost;Port=3306;database=epibot;uid=[YOUR MYSQL USER ID];pwd=[YOUR MYSQL PASSWORD];"
},
"DiscordToken": "[YOUR DISCORD TOKEN]"
}
- Back in the terminal, in the EpiBot directory build the project:
dotnet build
- Create database from migration data:
dotnet ef database update
- Run project:
dotnet run
The bot has two types of interactions: text commands and slash commands. Text commands are performed by sending a message whose first character is either the prefix !
or a Discord mention targeting the bot, followed by the command and then any parameters the command requires.
Examples:
!help
or
@EpiBot#4471 help
Slash commands are performed by entering the /
character into the message field. This will bring up a menu of all slash commands on that server, and can be filtered by the provider of the command. A menu will display the commands (filtered as you begin typing), and the selected command's parameters will be shown. You can navigate the menu with the keyboard or mouse.
Displays a summary of all available commands and their parameters.
Registers a github byline in the database for later retrieval using /byline-generate. Requires two parameters, name and email, which should match the name and email used for github co-author attribution.
Retrieves a registered byline from the database. Requires name1, optionally accepts name2, name3, name4. Uses a "fuzzy search" to select the name(s) from among those registered in the database.
Retrived information about a CodeWars user from the CodeWars API. Requires user-name parameter, which should match the desired CodeWars user name.
Registers an important link in the database for later retrieval using /importantlink-view. Requires two parameters: description and link.
Retrieves and displays all important links from the database.
Deletes a link. Requires one parameter: Id.
Provides information about a user. With no parameter given it will return information about the requesting user. With optional user parameter given, will return information about the indicated user.
Returns information about the server.
Displays a meme. Accepts an optional parameter subreddit, which will determine which subreddit the meme is retrieved from.
Deletes messages from the channel. Requires parameter number, which indicates the number of messages to be deleted.
Randomly assigns pairs from a list of names. Requires parameter list-of-names, which should be given as a space-separated list of names to be paired. If an odd number of names are given, the first "pair" will be assigned an extra name. Once used, the response contains a button which can be used to reshuffle pairs from among the same set.
Using this command while not currently registered for login/logout reminders will register the user to receive the reminders. Using this command while currently registered will un-register the user. Reminders are sent by DM to registered users at ~07:45AM (to log in to Epicenter) and ~04:45PM (to log out from Epicenter).
Searches stackoverflow.com for a provided question and displays the top five results. Requires parameter question which is the question to search for. Optionally accepts parameter sort, which has two options: sort by recent activity, or sort by most votes.
Using this command while not currently registered for pet notifications will register the user to receive notifications. Using this command while currently registered will un-register the user. Sends a DM notification to registered users each time a message containing an image is sent to a particular channel.
- None
Hippocratic License 3.0, Copyright 2022 Kate Kiatsiri, Aaron Minnick, Anna Pittman, Jeff Terrell, Colt Thatcher, and Hannah Young.