If you want to contribute to this bot PLEASE contact papetoast on discord. I will be happy to onboard you.
This is a discord bot designed to make the process of submitting, confirming and denying submissions easier. In addition to this, it manages a database of records automatically.
Read this in other languages: 🇮🇸
Setting up your own version of this bot is NOT RECOMMENDED as there is already an instance running which you can invite to your discord server. If you create your own instance, it will have a separate database to the already running instance. If you want to utilise this bot, skip to Discord Set Up.
To get this bot up and running on your machine, you will need a copy of this repository. To clone the repository, use:
git clone https://github.com/redstone-squid/Redstone-Squid.gitNote
If you have submodule.recurse set to true, you will pull supabase (2GB) for no reason other than running integration tests. It is recommended to set submodule.recurse to false before cloning this repository.
Then you can move to the repository's root directory with
cd Redstone-SquidNote
Node.js is not required even for development, it is only used in an experimental and optional tool pgstrap to dump the database schema.
There are a list of required python packages in requirements.txt. You can install them onto your machine directly or into a virtual environment (recommended)
If you want to use a virtual environment, first create the environment in the root directory and activate it.
python -m venv .venv
source .venv/bin/activateIn the root directory of the repository you can use the following command to install all the required packages. You can remove requirements/dev.txt if you just want to run the bot and not help develop it.
pip install -r requirements/base.txt requirements/dev.txtAlternatively, if you use uv, you can run uv sync. The requirements folder and uv.lock are kept in sync.
Google services requires a Google service account. You can read about google service accounts at https://cloud.google.com/iam/docs/understanding-service-accounts. Download the credentials JSON file and rename it client_secret.json and move it to the Google directory.
Discord requires a discord bot account. You can learn how to make bot accounts at https://github.com/reactiflux/discord-irc/wiki/Creating-a-discord-bot-&-getting-a-token. You will need the token to be placed in a file called .env in the root directory with the following contents:
BOT_TOKEN = <Replace this with your discord access token>
Supabase is the database used for this bot. You can sign up for a free account at https://supabase.com/. Once you have an account, you can create a new project and navigate to Project Settings | API and copy the URL and API key (secret, not public) to the same .env with the following contents:
SUPABASE_URL = <Replace this with your supabase url>
SUPABASE_KEY = <Replace this with your supabase api key>
The schema for the database can be obtained by applying the SQL files in Database/migrations in order.
To get the DATABASE_URL, click on the Connect button in the top of the Supabase dashboard and copy one of the connection strings (Direct connection, Transaction Pooler and Session Pooler all works, but for simplicity, use the Session pooler which supports IPv4 and overall just works nicely). The connection string should look like:
DATABASE_URL = postgresql://postgres.somerandomcharacters:[YOUR-PASSWORD]@aws-0-us-west-1.pooler.supabase.com:5432/postgres
DB_DRIVER_SYNC and DB_DRIVER_ASYNC is the name of the database driver to use for synchronous and asynchronous database access respectively. You can keep it as the default values if you are using Supabase, which is just a postgres db under the hood. If you are using a different database, you can change these values to match your database driver.
Catbox is used as a free file hosting service.
CATBOX_USERHASH = <Replace this with your catbox user hash>
The application can now be run simply with:
python app.py
You can add your bot to your server by going to https://discordapp.com/oauth2/authorize?client_id=<REPLACE WITH YOUR BOT'S ID>&scope=bot. It is recommended to give the bot administrator permissions but is not required for its functionality.
If you wish to invite the main instance to your server, click here.
Before the bot can post any records to your server, you must tell it here to post each category. Multiple categories can be set to a single channel.
As an example, let's pretend you want to set all categories to post to a channel called #records. Within the discord server you would run:
!settings smallest_channel set #records
!settings fastest_channel set #records
!settings first_channel set #records
Whenever a submission is confirmed by the bot's admins, it will be posted in the respective channel.
You can unset a channel by either setting it to another channel or running the unset command e.g.
!settings unset smallest_channel
In addition to this, you can check which channel a setting is currently set to via the query command e.g.
!settings query fastest_channel
If you want to query all settings at once, you can run:
!settings query_all
This list of commands is subject to change due to improvements and new features. In fact, discord.py provides self-documenting help messages for each command, so you can always run !help to see the most up-to-date list of commands.
!invite_linkgives the user a link which they can use to add the bot to their servers.!source_codelinks a user to this GitHub repository.!submit_recordprovides a user to the Google Form which is used for collecting record submissions.!settingshas been discussed above.!submissionsis a server specific, role specific set of commands used to view, confirm and deny submissions. This will be discussed below.!help <command>provides a user with a help message. If a command is provided, a help message for that command will be provided.
!submissions open provides an overview submissions that are open for review.
!submissions view <index> displays the full submission with a given index.
!submission confirm <index> confirms a submission and posts it to the correct channels.
!submissions deny <index> denies a submission.
Please read CODE_OF_CONDUCT.md for details on our code of conduct, and the process for submitting pull requests to us.
This project is licensed under the MIT License - see the LICENSE.md file for details