Skip to content

C# Team Week project. Discord bot that tells jokes via a dad joke API. Currently hosted on DigitalOcean for anyone to invite to their Discord server.

Notifications You must be signed in to change notification settings

Pingel88/DadJokeDiscordBot.Solution

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

71 Commits
 
 
 
 
 
 

Repository files navigation


|| 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

🌐 About the Project

📖 Description

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.

🦠 Known Bugs

  • It's too perfect.

🛠 Built With


🏁 Getting Started

📋 Prerequisites

Install .NET Core 2.1

  • 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.

Install .NET Script

Enter the command dotnet tool install -g dotnet-script in Terminal for macOS or PowerShell for Windows.

Code Editor

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.

  1. Code editor download:
  2. Click the download most applicable to your OS and system.
  3. Wait for download to complete, then install -- Windows will run the setup exe and macOS will drag and drop into applications.
  4. Open your editor, and open the Command Palette by pressing Cmd+Shift+P for Mac, or Ctrl-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.
  5. Optionally, create a GitHub account

Install Docker

(Optional) Download and install Docker

⚙️ Setup and Use

Cloning

  1. Navigate to the Discord bot repository here.
  2. Click 'Code' to reveal the HTTPS url ending with .git and the 'Download ZIP' option.
  3. Open up your system Terminal or GitBash, navigate to your desktop with the command: cd Desktop, or whichever location suits you best.
  4. Clone the repository to your desktop: $ git clone https://github.com/Pingel88/DadJokeDiscordBot.Solution.git
  5. Run the command cd DadJokeDiscordBot.Solution to enter into the project directory.
  6. View or edit:
    • Code editor - Run the command atom . or code . 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.

Download

  1. Navigate to the Discord bot repository here.
  2. Click 'Code' to reveal the HTTPS url ending with .git and the 'Download ZIP' option.
  3. Click 'Download ZIP' and extract.
  4. Open by double clicking on any of the files to open in a text editor.

EnvironmentVariables

  1. Create a new file in the DadJokeDiscordBot.Solution/Bot/Models directory named EnvironmentVariables.cs.

  2. 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]";
      }
    }
    
  3. 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.

Acquire API Key

  1. Create an account with RapidAPI in order to obtain an API key.
  2. Visit the pricing tab of the Dad Jokes page to subscribe to the API. The free tier should suffice for testing purposes.
  3. 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.
  4. Replace the entire [API KEY] placeholder text in your EnvironmentVariables.cs file with the API key.

Acquire Bot Token

  1. 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.
  2. 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!.
  3. To acquire the bot token, click on Copy under Build-A-Bot to copy your token to your clipboard.
  4. Replace the entire [BOT TOKEN] placeholder text in your EnvironmentVariables.cs file with your bot token.

Launch Application

With your environment variables in place, you are only a few terminal commands away from launching the bot.

  1. In the DadJokeDiscordBot.Solution/Bot repository:
    • Enter dotnet restore in your terminal.
    • Enter dotnet run in your terminal.
  2. 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.
  3. Copy the URL at the bottom of Scopes, and paste into the browser to invite the bot to servers you are an admin of.

Deploy via Docker

  1. Install the Docker app if you haven't already, and create an account.
  2. Create a new repository.
  3. 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.
  4. Now you are ready to host this application remotely with any cloud provider that supports Docker!

🛰️ Add OUR Bot

  1. Click here.
  2. If you are not logged in to Discord already, go ahead and do that now.
  3. Select the server you wish to add the bot to.
  4. Click Continue.
  5. Click Authorize.
  6. Enjoy!

🤝 Contributors

Author GitHub Email
Mike Pingel Pingel88 [email protected]
Morgan Bradford MorganJBradford [email protected]
Levi Kohler levi-kohler [email protected]
Jeroen van Seeters Jeroenemo [email protected]

✉️ Contact and Support

If you have any feedback or concerns, please contact one of the contributors.

Report Bug · Request Feature


⚖️ License

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.

🌟 Acknowledgements

"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.)


Return to Top

About

C# Team Week project. Discord bot that tells jokes via a dad joke API. Currently hosted on DigitalOcean for anyone to invite to their Discord server.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •