A bot that sends user's online status for the game Rust
Rust (the game not the language) alerts is a Discord bot that will send a message to a channel with information about what players are online. It uses the Battlemetrics API to get the player list and then checks if the user is online.
.env
file in the root directory or add environment variables with the following information:BOT_TOKEN=<YOUR_BOT_TOKEN, REQUIRED>
GUILD_ID=<YOUR_GUILD_ID, REQUIRED>
LOG_LEVEL=<LOG_LEVEL, optional> [default: INFO]
SAVE_FILE=<SAVE_FILE, optional> [default: ./savefile.json]
go build
`./playertrackerbot`
I recommend running this as a service so it can run in the background and can auto restart in case of a crash.
docker build -t rust-game-alerts-discord-bot .
or
docker buildx build -t rust-game-alerts-discord-bot .
To Run:
docker run -d -v playertracker-data:/data --env-file .env -e SAVE_FILE=/data/savefile.json --name discord-playertracker rust-game-alerts-discord-bot
Note: After testing and verifying it starts up, it's recommended to add --restart unless-stopped
to the docker run command after the -d
to ensure the bot restarts if the container crashes.
Ensure that your .env file has a BOT_TOKEN and GUILD_ID set. LOG_LEVEL is optional, and SAVE_FILE is automatically set by the Docker file.
docker-compose up --build -d
Note: Despite what Docker says the restart policy will start spamming immedietly if the bot crashses on startup. So please ensure your BOT_TOKEN and GUILD_ID are correct before running the bot.
Starts the tracker. Battle Metrics Server ID is requried to run the first time. If it is not provided, the bot will use the last server ID that was used.
Stops the tracker.
Adds user(s) to the tracker. Seperate multiple names with a comma. The name doesn't need to be exact and is not case sensitive. The search algorithm prioritizes exact matches first, then names that start with the inputted name, and finally names that contain the inputted name.
Similiar to the add command, but uses the Battle Metrics player ID instead of the player name. Useful when there are players with the same name.
Removes user(s) from the tracker. If a group is provided, it will only remove from that group.
Moves a user to a different group.
Adds a group to the tracker.
Removes a group from the tracker.
Sets the location of the group. This gets added next to the group name in the tracker. Useful for noting the base location of a group. Running this command without location will remove the location.
Sets the notes of the group. This gets added below the group name in the tracker. Useful for adding additional information about the group. Running this command without notes will remove the note.
Gets information about a user, including their BattleMetrics profile which will show the times they were on.
Gets information about a group.