/thonk-bot

The source code for a discord bot that I am creating to learn more about the discord.py rewrite, as well as an excuse to do something when I'm bored.

Primary LanguagePythonGNU General Public License v3.0GPL-3.0

Library - Discord.py Lines of code GitHub language count GitHub Website

Thonk Bot

About

The source code for a Discord bot built on Python and run on Docker, that I am creating to learn more about the discord.py rewrite, as well as an excuse to do something when I'm bored.

I'm mainly using the discord.py library, and experimenting with PyNaCl for voice support.

As of right now, I do not plan on making my bot for public use, so I will not be providing a link to invite the bot to servers. However, this may change later on.

If you would like to see more projects from me, make sure to check out my GitHub!

The bot's documentation can be found here.

Running with Docker

Dockerfile

I have already created a Dockerfile that can be used to build the Docker container which will run the bot. It does the following:

  1. Pulls the Python 3 Base Image from the Docker Repository.
  2. Sets the working directory to /usr/src/app.
  3. Copies all the program files to the working directory.
  4. Installs all the package dependencies required for the project (See requirements.txt)
  5. The CMD and ENTRYPOINT instructions tell the container to run the bot (launcher.py) when the container starts.

Building & Running

First check if docker is installed with docker --version (docker-compose --version or docker ps might be needed instead.) In case Docker is not installed, install it with this guide. Once it is installed, you can use the docker_setup.sh or docker_setup.bat scripts that I have created to automatically build the image, create a thonk-bot container, and run container.

Running the bot

Prerequisites & Dependencies

All private bot & API info are stored in an Environment file (.env). Create it in thonk-bot/lib/bot/.env and make sure that the following are available in the file:

  • Token
  • Prefix
  • Brainshop API (API KEY)
  • Brainshop API (BRAIN ID)

If you're unsure of what to do, just paste the following into the file (make sure to replace the placeholders with the proper information!):

TOKEN="<TOKEN GOES HERE>"
PREFIX="<PREFIX GOES HERE>"
API_KEY="<BRAINSHOP API KEY GOES HERE>"
BRAIN_ID="<BRAINSHOP BRAIN ID GOES HERE>"

The TOKEN is the bot key that you generate from your application in the Discord Developer page. This bot will also contain code for slash-commands, so you will need to make sure your bot app has access to them.

License/Modification

If you plan on using part of or even all of this code for your own bots, you are welcome to do so and modify it as well. However, I ask that you credit me and keep the LICENSE file intact to comply with the GNU GPL v3 license. It may seem annoying, but it helps ensure that the work I put into this does not go to waste. Thank you for understanding!