This is a Discord bot written in Python, with the purpose of helping our guild manage the scholars in our Discord server. The purpose of this bot is that it can be used for guilds with multiple scholars and different managers, who each have their own scholars and wallets.
To run this bot you need to host it yourself, meaning that you should have something that functions as a server. I use my Raspberry PI for this, but there are many other options available for hosting a Discord bot, such as virtual private servers provided by Google, Amazon, Microsoft, and more.
This bot was made with configurability in mind, meaning that every feature listed below can be turned on or off, and be changed easily. If you do not want a feature, just turn it off, all automation and listeners works for your custom roles and channels, so be sure to check out the settings in config_example.yaml and change them to your liking!
!announce
: Make announcements, using the bot as message sender. Usage !announce <#channel>
, followed by a next <text>
.!clear
: Clear a number of messages. Usage !clear <number>
, or !clear <number> <@user>
to clear messages of specific user.!encrypt
: Encrypt messages, necessary for encrypting private keys and storing them, using your personal uniquely generated encryption key. Usage !encrypt <message>
.!funds
: For managers to add their funds account address to the database. Usage !funds <ronin address>
.!help
: Custom written !help
command.!issue
: Make a new issue for this bot or any other public GitHub repository. Usage !issue <title>
followed by the description and labels. Needs your personal GitHub token to work, so this is disabled by default.!manager
: Scholars can request information about their manager using this command. Great if there are multiple managers in one server.!mute
/ !unmute
: Mute and unmute specific users. Usage !mute <@user>
, this gives a user the 'mute' role.!mydata
: Scholar can request their up to date data, consisting of: in game slp, MMR, rank, payout day, and the number of days untill payout day.!price
: Request suggested prices for selling your axie. Usage !price <axie ID>
, gives maximum 4 different prices based on different criteria.!scholar
: Adds a scholar to the database of scholars. Usage !scholar <scholar_discord_name> <address> <split> <payout_address> <encrypted_key> <[manager]>
. See the example below of how the values should look like.!tryout
: Start tryouts, divides users with role 'tryout' in specific channels. More about this below.!qr
: Scholars can request their QR-code in a dedicated channel. The bot will send them a private message containing their QR-code for login.In config_example.yaml this is also called 'Loops', you can customize each channel that these automated messages will get send in.
This section is about the other type of automation, which is based on events.
!announcement
command).Tryouts are used to select a new scholar from a group of people (with the role 'tryout'). For each account that is available for a new scholar a new tryout group can be made, it is also possible to make less groups and pick the first and second best players. Currently we let every tryout play for 3 hours on the account and after all tryouts are done the best will be picked. This is done by selecting the tryout that had the best winrate. At the moment the API for that is offline, so after a tryout is done they should send screenshots of their match history.
The code for the !qr
command was inspired by ZracheSs | xyZ, check out their repo for the original code.
The required packages to run this code can be found in the requirements.txt
file. To run this file, execute the following code block:
$ pip install -r requirements.txt
Alternatively, you can install the required packages manually like this:
$ pip install <package>
This part is about creating the Discord bot, setting up the basics, and inviting it to your server. For the first part you can watch this video (watch until 2:20).
Or follow these written instructions:
Then you need to add the custom emojis to the server (can be skipped).
Last you need to fill in the important information in config_example.yaml
, so the bot knows which server it should be connected to.
config_example.yaml
TOKEN:
(line 2)GUILD_NAME:
(line 3)This part needs to be done and is a bit technical, so follow the steps carefully. Or follow the instructions from this (starts from 1:58) video
If you prefer written instructions follow the instructions below:
authentication.json file
instructions.After follow the instructions above, last things you need to do is this:
authentication.json
file in the same folder as you saved the files for this bot.authentication.json
and copy the email behind "client_email":
authentication.json
Because no one likes to go through the process of making all the new channels, roles, and spreadsheets themselves I have written a script to do it for you. To run it you need to have followed the steps above, so you should have installed the dependencies, made the bot, and gave it access to your preferred Google Drive folder. If you have done all that you can execute the following code:
$ python src/setup.py
This will also rename config_example.yaml
to just config.yaml
so you do not need to worry about renaming that as well. The result will look like this:
So as the last step for the setup you need to copy your Fernet key to config.yaml
line 107, and after that is done you are ready for deploying the bot.
As you might have noticed the bot created a spreadsheet called Scholars. This spreadsheet functions as a database of your scholars. You can fill the values in by using the !scholar <scholar_discord_name> <address> <split> <payout_address> <encrypted_key> <[manager]>
command or by adding it manually to the sheet. The picture below shows how the values should look like.
As you might have noticed the bot also created a spreadsheet called Axie Alerts. This spreadsheet specifies the Axies that should be alerted in the server, for instance if they have a low price or good genes. Below an example is shown of how you can fill in this spreadsheet.
Example of an alert that the bot automatically sends:\
$ python src/main.py
!encrypt <private_key>
and use this in the step below.!scholar <scholar_discord_name> <address> <split> <payout_address> <encrypted_key> <[manager]>
command. !funds <ronin_address>
so it can track your buys and sells.