This guide will help you set up and run the Discord bot with integration to LoopScale.
- Python 3.x installed on your machine.
- A Discord Developer Bot Token.
- A LoopScale API Key.
-
Add a
.env
File:-
Create a
.env
file in the root folder of your project. -
Add the following environment variables to the file:
BOT_TOKEN= LOOPSCALE_API_KEY=
-
-
Insert Tokens:
- Discord Bot Token:
- Obtain your bot token by creating a new Discord application here.
- Ensure the bot has the necessary permissions:
Manage Roles
,View Channels
,Send Messages
, andUse Slash Commands
. You can also grantAdministrator
permission, though it is not mandatory. - Add the bot token to the
BOT_TOKEN
variable in your.env
file.
- LoopScale API Key:
- Insert your LoopScale API key into the
LOOPSCALE_API_KEY
variable in the.env
file.
- Insert your LoopScale API key into the
- Discord Bot Token:
-
Create a Virtual Environment (Recommended):
-
Although not mandatory, it's recommended to create a virtual environment for your project to manage dependencies and avoid conflicts with other Python projects.
-
You can create a virtual environment using the following command:
python -m venv venv
-
Activate the virtual environment:
- On Windows:
.\venv\Scripts\activate
- On macOS/Linux:
source venv/bin/activate
-
-
Install Required Packages:
-
Once the virtual environment is activated, install the required Python packages using the following command:
pip install -r requirements.txt
-
Configure Role ID:
- Open the
settings.py
file. - Set the
CLAIM_ROLE_ID
variable with the role ID you wish to assign to users who reach 10,000 points. - Important: Ensure that this role is lower in the role hierarchy than the bot's role in Discord, or the bot will not be able to assign it.
- Open the
-
Run the Bot:
-
Start the bot using the following command:
python main.py
-
-
Sync Commands:
-
To make the bot's commands available for use, send the following message to the bot in a direct message (DM):
-vmpsync
-
This is a one-time setup step that needs to be done before users can start using the bot's commands.
-
/leaderboard
: Displays the leaderboard for the top 10 members by points or waitlist rank./points
: Shows the points of a specific user./waitlist-rank
: Displays the waitlist rank of a specific user.