Skip to content

This bot leverages the Battlemetrics RCON API to display information about Squad bans as they are added to a Discord channel

License

Notifications You must be signed in to change notification settings

lukeg3/DiscordBotBattlemetricsNotifier

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

37 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Discord Bot Battlemetrics Ban Notifier

modified by lukeg3

This is a Discord bot to read squad bans (or probably bans of any game supported by Battlemetrics RCON) adapted from the Discord Bot Battlemetrics Ban Notifier created by Alexemanuelol@GitHub

This bot uses the Battlemetrics API to poll information about recently banned players at a regular interval and updates a discord server's text channel automatically whenever a new ban is detected.

Environment Setup

Script is written in Python 3.10

Run the following to setup the environment:

$ pip install -r requirements.txt

Configuration

Setting up the config.ini file

General

set the prefix for commands in the discord server (default option is "!" so a command would be "!help")

Discord

set the admins that can execute commands in the Discord server in the admins field, use commas to seperate admins (format: name#0000)

Set up the discord bot by following this guide Discord Developer Portal Getting Started and then put the bot token in the discordToken field in the config.ini file, DO NOT SHARE THIS TOKEN WITH ANYONE.

Choose which channel you want the bot to put embeds in the discord server and then right click on the channel and "Copy ID". Paste this id into the discordTextChannelId field in the config.ini file.

Battlemetrics

Get a battlemetrics token by going to the Battlemetrics Developers Area, select "New Token" then make sure "Ban Lists", "Bans", and "RCON" are fully checked. Click "Create Token", then copy the access token and put it in the battlemetricsToken field in the config.ini file, DO NOT SHARE THIS TOKEN WITH ANYONE.

Get the battlemetrics ban list id from Battlemetrics Ban Lists, click "View Bans" on the ban list you want to use. Then your URL will be https://www.battlemetrics.com/rcon/bans/?filter%5BbanList%5D="BANLIST ID IS HERE" copy the part that is where "BANLIST ID IS HERE" is and put it in the banListId field in the config.ini file.

Finally set the polling interval (in seconds) to determine how often the ban list is updated. The recommended time is 10 minutes which is 600 seconds.

Games this works with

At this time, this bot has only been tested with Squad. It should work for other games with slight modifications

Sources

Discord PyPI API wrapper

Battlemetrics API Documentation

About

This bot leverages the Battlemetrics RCON API to display information about Squad bans as they are added to a Discord channel

Topics

Resources

License

Stars

Watchers

Forks

Languages

  • Python 100.0%