Skip to content

Latest commit

 

History

History
111 lines (56 loc) · 4.45 KB

File metadata and controls

111 lines (56 loc) · 4.45 KB

Game-Server-Discord-Bot (Made in Disnake Py)

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

Planned Updates -

  • Remove serverName from config.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)

License -

Covered under Unlicense (https://unlicense.org)

Requirements -

Dependencies -

  • Run pip install requirements.txt from the CMD Prompt/Terminal in the project root

Config Walkthrough -

  1. Configure the config.json file to have your game server/bot parameters

image

"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 image

"BM_ServerID": "xxxxxxxx" - Set this as your servers BattleMetrics ID image

"statusText": "on KarmaMC - " - Set this as what you want before your playercount/maxplayer in the Bot's status image

Running the Bot -

  1. 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

  2. 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, use pm2 start "py bot.py" --name "Whatever you wanna name this")
  • If everything is configured correctly, your bots output should look like this: image

Inviting the bot to your server -

  1. Go to your bots dev app page and click "OAuth2" on the left side

  2. Under "OAuth2", click "URL Generator"

  3. Select scopes as shown in the below image

  4. Select bot permissions as shown in the below image

  5. Copy the link under the "Bot Permissions" box, paste it in your browser, login with Discord, and invite the bot to your server! gitreadme

Slash commands -

image

/lastcrash - Shows the last outage the server had

image

/locate - Shows the servers location

image

/playtime - Shows a players play-time on the server using their BattleMetrics playerID

image

/rank - Shows the servers rank on BattleMetrics

image

/status - Shows the server status and various info about the server (changes info shown based on game server type)

image

/uptime - Shows the servers uptime and when the last player joined

image