Skip to content

A discord bot that uses Wargaming's API to check the status of each server while also checking the ping locally

License

Notifications You must be signed in to change notification settings

ThatSINEWAVE/WGPinger-Bot

Repository files navigation

WGPinger - Server Monitoring Discord Bot

This Discord bot provides server statistics for Wargaming (WG) servers and allows users to check the ping for specific game servers. Additionally, it updates Discord channel names with real-time player counts and ping information.

Features

  • Get real-time Wargaming server statistics (player counts) by region
  • Check ping to specific game servers
  • Automatically update Discord channel names with server stats and ping information
  • Support for multiple regions: EU, NA, ASIA, and more
  • Easy configuration using environment variables

Installation

  1. Clone the repository:
git clone https://github.com/your-username/WGPinger-Bot.git
cd WGPinger-Bot
  1. Install the required Python packages:
pip install discord.py python-dotenv aiohttp
  1. Set up your environment variables:

Copy the example environment file and edit it with your credentials:

cp .env.example .env

Then edit the .env file with the following information:

  • Your Discord bot token
  • Your Wargaming Application ID
  • Channel IDs for server stats display
  1. Run the bot:
python main.py

Environment Configuration

The bot uses environment variables for all configuration settings:

  • DISCORD_BOT_TOKEN: Your Discord bot token
  • WG_APPLICATION_ID: Your Wargaming application ID
  • Server channel mappings (for each server):
    • SERVER_PLAYERS_CHANNEL_ID: Channel to display player count
    • SERVER_PING_CHANNEL_ID: Channel to display ping

Example for the .env file:

DISCORD_BOT_TOKEN=your_discord_bot_token_here
WG_APPLICATION_ID=your_wargaming_application_id_here

# Channel IDs
EU1_PLAYERS_CHANNEL_ID=123456789012345678
EU1_PING_CHANNEL_ID=123456789012345678

Commands

  1. /wgstats - Fetches Wargaming server statistics for a specific region.

Usage:

/wgstats [region]

region (optional): The server region ("EU", "NA", "ASIA", or "ALL"). Defaults to "EU" if not specified.

  1. /checkping - Checks the ping for a specific game server or all servers.

Usage:

/checkping [server]

server: The server API name or "ALL" to check ping for all servers.

Server Configuration

Server information is stored in clusters.json. This file contains details about each game server:

  • Server name
  • Location
  • Connection address
  • API identifier
  • Color code for display

Automatic Channel Updates

The bot automatically updates Discord channel names with:

  • Current player counts for each server
  • Current ping times in milliseconds

These updates occur every 5 minutes to avoid Discord API rate limits.

License

This project is licensed under the MIT License - see the LICENSE file for details.