Discord bot that pulls various info from your server and displays it through slash commands using BattleMetrics API. Also sets the status of the bot as playercount/maxplayers
/uptime
, /playtime
, and /lastcrash
do NOT work for MC servers right now, this is currently being worked on
- Remove
serverName
fromconfig.json
and make it auto grab the bot's name - add
/link
command for steam account integration with the bot (for auto-grabbing player stats from a BM server)
Covered under Unlicense (https://unlicense.org)
- Python 3.11+
- A discord bot application
- A game server that is on BattleMetrics (https://www.battlemetrics.com/)
- Run
pip install requirements.txt
from the CMD Prompt/Terminal in the project root
- Configure the config.json file to have your game server/bot parameters
"serverName": "KarmaDev"
- Set as the name you want to show up in sent slash commands, your servers name
"website": "https://krma.site"
- Set as your website
"iconURL": "xxxxxxxxxxxx.png"
- Set as the logo you want for slash command author
"token": "xxxxxx"
- Discord Bot Token (https://docs.discordbotstudio.org/setting-up-dbs/finding-your-bot-token)
"clientID": "xxxxxx"
- Discord Bot's Client ID
"Game": "gmod"
- Set this as this part of your server's BattleMetrics URL
"BM_ServerID": "xxxxxxxx"
- Set this as your servers BattleMetrics ID
"statusText": "on KarmaMC - "
- Set this as what you want before your playercount/maxplayer in the Bot's status
-
Install the dependencies by opening a terminal/cmd prompt in the folder your bot is located in and run the individual commands listed in dependancies above
-
Run the bot in a terminal/command prompt with Python (or PM2 with nodejs installed for linux)
- In a terminal or Command Prompt, run
python bot.py
(for PM2, usepm2 start "py bot.py" --name "Whatever you wanna name this"
) - If everything is configured correctly, your bots output should look like this:
-
Go to your bots dev app page and click "OAuth2" on the left side
-
Under "OAuth2", click "URL Generator"
-
Select scopes as shown in the below image
-
Select bot permissions as shown in the below image
-
Copy the link under the "Bot Permissions" box, paste it in your browser, login with Discord, and invite the bot to your server!
/lastcrash
- Shows the last outage the server had
/locate
- Shows the servers location
/playtime
- Shows a players play-time on the server using their BattleMetrics playerID
/rank
- Shows the servers rank on BattleMetrics
/status
- Shows the server status and various info about the server (changes info shown based on game server type)
/uptime
- Shows the servers uptime and when the last player joined