|| Dad Joke Discord Bot ! ||
___________________________
Mike Pingel | Morgan Bradford | Levi Kohler | Jeroen van Seeters
Initiated April 4th, 2021, Updated April 14th, 2021
Project Docs · Report Bug · Request Feature
A Discord bot that acts as a dad joke supplement to replace one of our retired instructors at Epicodus. Written in C#/.NET, it utilizes an API via RESTful principles, WebSocket protocol, and Docker containerization for remote server hosting.
Although no setup is required to simply invite the bot to your Discord server, if you would like to download, alter, or deploy the source code yourself, follow along with the instructions detailed in the Getting Started Section.
Otherwise, skip to the Add OUR Bot section to get started by adding the bot directly to your own Discord server.
- It's too perfect.
- On macOS Mojave or later
- Click here to download the .NET Core SDK from Microsoft Corp for macOS.
- On Windows 10 x64 or later
- Click here to download the 64-bit .NET Core SDK from Microsoft Corp for Windows.
Enter the command dotnet tool install -g dotnet-script
in Terminal for macOS or PowerShell for Windows.
To view or edit the code, you will need a code editor or text editor. The popular open-source choices for code editors are Atom and Visual Studio Code.
- Code editor download:
- Option 1: Atom
- Option 2: Visual Studio Code
- Click the download most applicable to your OS and system.
- Wait for download to complete, then install -- Windows will run the setup exe and macOS will drag and drop into applications.
- Open your editor, and open the Command Palette by pressing
Cmd+Shift+P
for Mac, orCtrl-shift-p
for Windows- For VS Code, type
Shell Command: Install 'code' command in PATH
into the Command Palette. - For Atom, type
Install Shell Commands
into the Command Palette.
- For VS Code, type
- Optionally, create a GitHub account
(Optional) Download and install Docker
- Navigate to the Discord bot repository here.
- Click 'Code' to reveal the HTTPS url ending with .git and the 'Download ZIP' option.
- Open up your system Terminal or GitBash, navigate to your desktop with the command:
cd Desktop
, or whichever location suits you best. - Clone the repository to your desktop:
$ git clone https://github.com/Pingel88/DadJokeDiscordBot.Solution.git
- Run the command
cd DadJokeDiscordBot.Solution
to enter into the project directory. - View or edit:
- Code editor - Run the command
atom .
orcode .
to open the project in Atom or Visual Studio Code respectively for review and editing. - Text editor - Open by double clicking on any of the files to open in a text editor.
- Code editor - Run the command
- Navigate to the Discord bot repository here.
- Click 'Code' to reveal the HTTPS url ending with .git and the 'Download ZIP' option.
- Click 'Download ZIP' and extract.
- Open by double clicking on any of the files to open in a text editor.
-
Create a new file in the DadJokeDiscordBot.Solution/Bot/Models directory named
EnvironmentVariables.cs
. -
Add the following code snippet to the new EnvironmentVariables.cs file:
namespace Bot.Models { public static class EnvironmentVariables { public static string ApiKey = "[YOUR API KEY]"; public static string BotToken = "[YOUR BOT TOKEN]"; } }
-
Please note that you will have to replace the
[YOUR API KEY]
and[YOUR BOT TOKEN]
placeholders with your own bot token and API key. Follow along with the subsequent instructions to obtain them.
- Create an account with RapidAPI in order to obtain an API key.
- Visit the pricing tab of the Dad Jokes page to subscribe to the API. The free tier should suffice for testing purposes.
- Navigate to the endpoints tab to obtain your API key -- you will have to copy it from the code snippets in the panel to the right.
- Replace the entire
[API KEY]
placeholder text in your EnvironmentVariables.cs file with the API key.
- You will have to sign in with your Discord account in order to create a new bot app. If you don't have one already, sign up here.
- This link will take you to the developers dashboard to begin setting up your dad joke bot.
- Select new application.
- Name the application.
- Select
Bot
on the left. - Select
Add Bot
on the right. - Select
Yes, do it!
.
- To acquire the bot token, click on
Copy
under Build-A-Bot to copy your token to your clipboard. - Replace the entire
[BOT TOKEN]
placeholder text in your EnvironmentVariables.cs file with your bot token.
With your environment variables in place, you are only a few terminal commands away from launching the bot.
- In the DadJokeDiscordBot.Solution/Bot repository:
- Enter
dotnet restore
in your terminal. - Enter
dotnet run
in your terminal.
- Enter
- Invite the bot to your server, Back in the developers dashboard, apply the following steps:
- Select
OAuth2
on the left. - Select
Bot
under scopes. - Select
Send Messages
under Text Permissions inside of Bot Permissions.
- Select
- Copy the URL at the bottom of Scopes, and paste into the browser to invite the bot to servers you are an admin of.
- Install the Docker app if you haven't already, and create an account.
- Create a new repository.
- In the DadJokeDiscordBot.Solution/Bot repository, run
docker build -t <your-app-name> .
- Run
docker build -t <your_username>/<your_repo_name> .
to build your Docker image. - Run
docker run <your_username>/<your_repo_name>
to test your Docker image locally. - Run
docker push <your_username>/<your_repo_name>
to push your Docker image to Docker Hub.
- Run
- Now you are ready to host this application remotely with any cloud provider that supports Docker!
- Click here.
- If you are not logged in to Discord already, go ahead and do that now.
- Select the server you wish to add the bot to.
- Click
Continue
. - Click
Authorize
. - Enjoy!
Author | GitHub | |
---|---|---|
Mike Pingel | Pingel88 | [email protected] |
Morgan Bradford | MorganJBradford | [email protected] |
Levi Kohler | levi-kohler | [email protected] |
Jeroen van Seeters | Jeroenemo | [email protected] |
If you have any feedback or concerns, please contact one of the contributors.
This project is licensed under the MIT License. Copyright (C) 2021 Mike Pingel, Morgan Bradford, Levi Kohler, Jeroen van Seeters. All Rights Reserved.
MIT License
Copyright (c) 2021 Mike Pingel, Morgan Bradford, Levi Kohler, Jeroen van Seeters.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
"A school for tech careers... to help people learn the skills they need to get great jobs."
"...the first thing that humanity has built that humanity doesn't understand..."
-Eric Schmidt, Google (Alphabet Inc.)