I wanted something to do on my spare time outside of my work as a DevSecOps Engineer and my studies at Nackademin. So i decided to create a discord bot for use in my class discord server. I also wanted to experiment with setting up github actions.
This is a discord bot that currently has a few functionalities
Once the Discord Bot is running in your server, you can interact with it using the following methods:
/command_name arguments
Commands available:
/chatgpt <message>
: Interact with ChatGPT using the provided message./image <message>
: DALL-E will generate a image for you based on the message.
/dm
: Send a direct message to the specified user with the provided message.
/github_stats
: Shows simple github stats
/schedule
: Shows a schedule for the next n days
/about
: Get information about the ChatGPT Discord Bot./help
: Display a list of available commands and their usage.Example:
Sender: /chatgpt What is the capital of France?
Theodore: @Sender: The capital of France is Paris.
/github_stats
the console will spit out x_order_2: colinear!
If you want to contribute to this project, please read the CONTRIBUTING file.
I have not provided either the OpenAI API key or the discord bot token. You will need to create your own.
The config.json file is used to configure some settings of the bot.
The file is located in the src/config
folder.
Variable | What it is | Default |
---|---|---|
openai.model | The OpenAI model to use | chatgpt-3.5-turbo |
openai.temperature | The temperature to use for OpenAI model responses | 1 |
openai.max_tokens | The maximum number of tokens to generate for OpenAI model responses | 4000 |
Variable | What it is | Default |
---|---|---|
discord.dedicated_channel_id | The ID of the dedicated channel for the bot to listen to messages on | None |
discord.log_folder | The folder where logs will be stored | /logs |
discord.log_path_channel | The path for channel logs | Showlogs/channel_{time: YYYY-MM-DD-HH-mm-ss! UTC}.log |
discord.log_path_command | The path for command logs | Showlogs/command_{time: YYYY-MM-DD-HH-mm-ss! UTC}.log |
discord.log_path_discord | The path for discord logs | Showlogs/discord_{time: YYYY-MM-DD-HH-mm-ss! UTC}.log |
discord.log_level | Log level for the discord logger | DEBUG |
Variable | What it is | Default |
---|---|---|
logger.log_path_info | The path for info logs | Showlogs/info_{time: YYYY-MM-DD-HH-mm-ss! UTC}.log |
logger.log_level | The level of logging to use | DEBUG |
logger.log_rotation | The maximum size of each log file before it is rotated | 100000000 |
logger.log_retention | The length of time to retain log files for | 730 days |
logger.log_compression_format | The format of the compressed log files | zip |
Variable | What it is | Default |
---|---|---|
schedule.url | URL to your class schedule | None |
Variable | What it is | Default |
---|---|---|
github.user_stats | API link for stats | |
github.user_streak | API link for streak | |
github.default_user | Default user for stats and streak API of no username is provided in the command | mindriddler |
You can change these values to whatever (as long as they're valid) you want and the bot will respect them
.env.template
in the root of the project to .env
OPENAI_API_KEY=<your api key>
DISCORD_TOKEN=<your bot token>
Discord_bot/src/config/config.json
Docker
docker-compose up -d
If you prefer not to build the Docker image yourself, you can pull the pre-built images from GitHub Container Registry (GHCR). However, you will still need to provide your own OpenAI API key and Discord bot token.
To pull the images from GHCR, use the following command:
docker pull ghcr.io/mindriddler/discord-bot:<tag>
Replace <tag>
with the appropriate tag for the version you want to use (e.g., latest
).
After pulling the image, you can run the container using the following command:
docker run -d --name discord-bot --env-file .env ghcr.io/mindriddler/discord-bot:<tag>
Replace <tag>
with the same tag used when pulling the image.
If you encounter any issues while setting up or using the ChatGPT Discord Bot, please consult the following resources:
This project is licensed under the GNU License - see the LICENSE file for details
If you want to contact me you can reach me at
Wikipedia#5457
fredrikmagnusson10@live.se
This project is not affiliated with OpenAI or Discord in any way.