/gabitodev-bot

An Axie Infinity Discord bot that helps to manage your scholarship right in your discord server.

Primary LanguageJavaScript

gabitodev-bot

A discord bot for Axie Infinity that helps manage your scholarship right on your discord server.

The discord bot will run in your local machine. You can deploy this bot in AWS if you want.

Features

Scholar Commands

/balance shows the balance of the account. This command accepts one argument the teamId of the scholar team.

image

/battles-stats returns a summary of the last 100 battles played by the scholar.

image

Owner Commands

/add-scholar adds a scholar to the bot database. This command accepts three arguments:

  • Discord user: the scholar discord user. Required.

  • Full Name: the name of your scholar. Required.

  • Payout Address: is where the scholar receives their payouts. Leave it blank if you don't already have this information. Optional.

image

/add-team adds a team to the bot database. This command accepts three arguments:

  • Team ID: the team id of the account (account number) it cannot be repeated. Required.

  • Ronin address: your team ronin address. Required.

  • Daily fee: can be a percentage (example: 0.5 is 50%) or it can be a static number charged daily (example: 30 SLP). Required.

image

/assign-team assign a team to scholar. This command accepts two arguments:

  • Team ID: the team that will be assigned. Required.

  • Discord user: scholar who will play with this team. Required.

image

/get-battles get the summary of the last 100 battles of one scholar. This command accepts only one argument:

  • Discord user: the scholar whose battles will be shown. Required

image

/get-scholar get the information of one scholar. This command only accepts one argument:

  • Discord user: the scholar whose information will be shown. Required

image

/payout get all the scholars who are ready to payout.

image

/remove-scholar kicks scholar from the discord server and removes from the database. This command only accepts one argument:

  • Discord user: the scholar who will be deleted and kicked. Required

image

/remove-team kicks scholar from the discord server and removes from the database. This command only accepts one argument:

  • Team ID: the account number to delete. Required

image

/summary shows the summary of your scholarship.

image

top-3 shows the best top 3 of your scholarship order by MMR.

image

/update-free-days Assign free days to a team if this team is charged a daily fee. This command accepts two arguments:

  • Team ID: the account number to add the days without daily fee. Required

  • Free days: the ammount of days. Required

image

/update-scholar-address updates the payout address of one scholar. This command accepts two arguments:

  • Discord User: the scholar who payout address will be changed. Required

  • Payout address: the new payout address. Required

image

/update-scholarship updates the database with the game information of each scholar.

image

I recommend to run this command before run /summary command because this ensures that the database has the latest information from the Axie Servers.

/update-team-fee updates fee of one team. This command accepts two arguments:

  • Team ID: the account number to update the daily fee. Required

  • Daily fee: can be a percentage (example: 0.5 is 50%) or it can be a static number charged daily (example: 30 SLP). Required.

image

Necessary tools to run the bot

Windows 10

  1. Download NodeJS from the official website: https://nodejs.org/es/download/. Install the LTS version.
  2. Download Git for windows from the official website: https://gitforwindows.org/. Follow the steps to install git.

Linux

Node JS
  1. Open your Ubuntu command line (or distribution of your choice).
  2. Install cURL (a tool used for downloading content from the internet in the command-line) with: sudo apt-get install curl
  3. Install nvm, with: curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.1/install.sh | bash
  4. To verify installation, enter: command -v nvm ...this should return 'nvm', if you receive 'command not found' or no response at all, close your current terminal, reopen it, and try again.
  5. Install the current stable LTS release of Node.js (recommended for production applications): nvm install --lts.
Git

For the latest stable Git version in Ubuntu/Debian, enter the command:

sudo apt-get install git

Downloading the Code

In your terminal opened to the folder you want to install the bot to, run the following command:

git clone https://github.com/gabitodev/gabitodev-bot.git

Enter yes and wait for the download to end. Leave your terminal open and follow the following steps.

Bot Setup

Setting up a Discord Bot Account

  1. Navigate to the Discord developer portal website and login with your main Discord account: https://discord.com/developers/applications.

  2. Click the New Application button at the top right:

    image

  3. Name your bot and click Create. This should be named after your scholarship program.

  4. Go to the Bot section on the left-side menu:

    image

  5. In the bot section click the Add Bot button:

    image

  6. Name your bot and proceed to reset the bot token:

    image

  7. As soon you click reset token you need to copy the new generated token and save it for now in notepad. You will need this for later.

Create the URL to Invite your Bot

  1. Go to the OAuth2 page from the left menu:

    image

  2. Copy your client ID and save it in your notepad:

    image

  3. Click on the URL Generator and select the bot and applications.commands scopes. The first gives the account bot privileges and the second allows for slash commands.

    image

  4. Select all the permissions the bot needs to run, shown below:

    image

  5. Copy the bottom URL and paste it in the browser of your preference. This will bring you to a Discord menu to select which server to add your bot to. Only servers you have permissions to add bots on will be displayed. Select your server and confirm.

    image

Now the bot is in your discord sever but at the moment it doesn't work. We need to setup the code for the bot first.

Setting up de code for the Bot

Filling out the env

First, you will need to fill out your env file. The bot comes with an example.env file. Rename to env. You will need to add your bot token, the client ID for the bot, the scholar role ID of your scholars in your discord server and the guild ID of your server (ID of your discord server). See the example.env file for more information.

Install the necessary dependencies

In your terminal where you bot was downloaded, run the followind command:

npm install

If the process fail, try again. This will install all of the necessary dependencies to run the bot.

Create the tables

Run the following command: npm run create-tables. This structures the database to work with the bot.

Import scholar and team data

Make sure that you already create the tables for the database.

If you have a large Scholarship progam, you may want to import the data in advance rather then add each scholar and team one by one. You will need to make a CSV file where you put all the information. Follow this format:

For scholars:

image

discordId the scholar discord id, you can get this directly from discord. If you dont know how to get this Google is yours best friend. Required.

fullName the name of your scholar. Required.

payoutAddress is where the scholar receives their payouts. Leave it blank if you don't already have this information. Optional.

For teams:

image

teamId the team id of the account (account number) it cannot be repeated. Required.

roninAddress your team ronin address. Required.

daily fee can be a percentage (example: 0.5 is 50%) or it can be a static number charged daily (example: 30 SLP). Optional.

renterDiscordId the scholar discord id who plays with this team. You can add this information later. Optional.

Download this two CSV files and paste it inside the database folder where you downloaded the bot. Now run in your terminal the following command: npm run import-tables. This will create the database with the data that you supplied. If you want to delete your database simply delete the db file in your bot folder or rerun the npm run import-tables command.

Run the bot

Now that we have all set run in your terminal the following command to put the bot online:

npm run start

This will launch the bot and now you and your scholars can use it in your discord server.