In the fast-paced world of Discord, managing and making sense of extensive text conversations can be challenging. As the volume of messages grows, it becomes increasingly difficult to stay informed and engaged in discussions. Our solution addresses this problem with a bot designed to streamline and simplify text management on Discord.
Welcome to the code repository of 'Suave Supernovae' for the Python Discord Code Jam 2024!
We are excited to present our Discord Text Management Bot. As communication on Discord grows more complex, traditional methods for managing and understanding conversations can become inadequate. This challenge can make it difficult for users to stay informed and engaged, especially in active or large servers.
Our approach introduces features designed to enhance conversation management.
This approach aims to alleviate the difficulties associated with text overload and improve the overall experience of managing and participating in Discord discussions.
This README consists of the following sections:
Our project has the following key features:
- Our project features an AI-powered summarizer that delivers a concise summary of conversations in any text channel, allowing users to quickly grasp ongoing discussions.
- The Ask the bot feature lets users query the bot about any topic, even if it hasn’t been mentioned in the current conversation, avoiding the need to search through past messages or leave Discord.
- This discord application gives users the ability to fetch Wikipedia articles on specific topics directly within the Discord channel, providing instant access to relevant information.
- The Message saver functionality enables users to save and retrieve important messages swiftly, ensuring easy access to critical information.
- The Help command offers descriptions of all available commands, helping users understand and utilize the bot’s features effectively.
Before you can use the discord bot, there are some setup steps you need to follow. This ensures the application works flawlessly on your local machine.
-
Installation: Before anything else, you need to set up the environment. Please follow our detailed installation guide to get everything in place.
-
Running the bot: Once installed, the next step is to start the bot. please follow the guide on how to run the project.
With the application up and running, you can now explore the discord bot's capabilities:
- To save messages simply select your message of choice and when the context menu pops up you should see a section named apps. Inside of that section you should see the ability to save a message.
- To view your saved messages, click on the bot's icon, go to apps and select see saved messages.
- If you want to use the summarizer command, run '/summarizer' in the thread or channel you want summarized.
- To use the ask command so that you can ask a question based on the chat or outside of chat, run '/ask'.
- For bringing up wikipedia articles in the chat, run '/wikisearch'.
- If you ever forget the usage of a commmand, run '/help' to get a description of all of the commands.
Below are instructions on various ways to install this project. You can choose to either:
- Set up a local development environment, or
- Use the provided development container (requires Docker)
To develop this project on your local machine, follow the steps outlined below.
Note: Ensure you have Python version 3.11 installed. If not, download it from here.
To install the project locally you first need to run the following line to install all of its requirements
pip install -r requirements.txt
after that make sure to run the following command:
python -m src.utils.db apply-all
Note: Due to last minute implementations you will have to rename .env.local to .env in the src/utils/env.py file if you wish to use this approach
This project includes a development container to simplify the setup process and provide a consistent development environment.
You can use the dev container locally with either Visual Studio Code or PyCharm, or remotely with GitHub Codespaces.
Note: The following instructions assume that you have already installed Docker and Visual Studio Code.
-
Install the Remote Development extension pack in Visual Studio Code.
-
Make sure the Docker agent is running, and open Visual Studio Code.
-
Press
F1
to open the command palette, and then type "Dev-Containers: Clone Repository in Container Volume" and select it from the list. Alternatively, you can click on the green icon in the bottom-left corner of the VS Code window and select "Dev-Containers: Clone Repository in Container Volume" from the popup menu. -
Next, the command palette will ask you for the repository URL. Copy the URL of the GitHub repository, paste it into the command palette and confirm by pressing
Enter
. -
VS Code will automatically build the container and connect to it. This might take some time for the first run as it downloads the required Docker images and installs extensions.
-
Once connected, you'll see "Dev Container: Suave Supernova" in the bottom-left corner of the VS Code window, indicating that you are now working inside the container.
-
You're all set! You can now run, develop, build, and test the project using the provided development environment.
To connect PyCharm to the Development Container, please follow these instructions provided in the official JetBrains documentation.
-
Ensure that you have access to GitHub Codespaces.
-
Navigate to the GitHub repository for the project.
-
Click the "Code" button and then select "Open with Codespaces" from the dropdown menu.
-
Click on the "+ New codespace" button to create a new Codespace for the project.
-
GitHub Codespaces will automatically build the container and connect to it. This might take some time for the first run as it downloads the required Docker images and installs extensions.
-
Once connected, you'll see "Dev Container: Suave Supernova" in the bottom-left corner of the VS Code window, indicating that you are now working inside the container.
-
You're all set! You can now run, develop, build, and test the project using the provided development environment.
after these steps make sure to run the following command:
python -m src.utils.db apply-all
Note: You may run migrations manually.
-
For running this project you will need a discord bot token by getting it from the discord developer portal. Follow the instructions on there to also add the bot to the server of your choosing.
-
You will also need a groq token which you can get from here.
-
If you have installed the project locally you will also need to add a database dsn which can be done by running a postgres database and getting its connection string.
You can also use neon to get your dsn.
Execute this in your postgressql terminal to create the migrations table:
CREATE TABLE IF NOT EXISTS migrations (
name TEXT PRIMARY KEY
);
-
You will now need to go the env.py file located in 'src/utils/env.py and rename '.env.local' to '.env'
-
Your .env file should now look something like this.
- After having added the tokens and the database dsn to your .env file you can now run the bot on the server you've added it to.
If you installed the project locally you can run the project by running the following line in the root of the project.
python -m src
or alternatively you can run the bot using the container that was provided.
This project was built by Suave Supernovae
team as part of the Python Discord Code Jam 2024. These are the team members and their main contributions:
Avatar | Name | Main contributions |
---|---|---|
![]() |
Aekardy | ask command |
![]() |
Adrian Carton De Wiart | search command, help command |
![]() |
TheLastMethBender | summarizer and ask command, groq integration |
![]() |
NaviTheCoderBoi | bot starter code, database setup |
![]() |
Butter Dog | message saver, database setup |