Skip to content

A Python-based utility that monitors your network ping in real-time and sends alerts to Discord when latency exceeds a specified threshold.

License

Notifications You must be signed in to change notification settings

bebe-Kexe/ping-monitor-x-discord

Repository files navigation

Ping Monitor with Discord Notifications

A Python-based utility that monitors your network ping in real-time and sends alerts to Discord when latency exceeds a specified threshold.

Discord Notification Example

Made this out of boredom from high ping, which made me rage in competitive games.

Total time spent on this project:

wakatime

🌟 Features

  • Real-time ping monitoring to a specified host (default: google.com)
  • Discord notifications when ping exceeds the threshold
  • Custom status on your Discord bot showing your current ping condition
  • Configurable thresholds to match your needs
  • Robust error handling to prevent crashes
  • User-friendly setup and startup scripts with batch files

📋 Requirements

  • Python 3.11+ (recommended)
  • Discord bot token and permissions
  • Internet connection

🚀 Installation

  1. Download LATEST RELEASE zip (always called after the version)

    • Unzip it into your desired directory
  2. Install dependencies:

    • Open the ping-monitor-x-discord folder
    • Simply double-click setup.bat

💻 Usage

Run the script with:

  • Double-click start.bat
    • If this is your first time running it, a .env_vars file will be created. Open it with a text editor and specify DISCORD_TOKEN, CHANNEL_ID, and USER_NAME (optional).

⚙️ Configuration

Edit the following variables in .env_vars to customize your experience:

DISCORD_TOKEN=xxx.yyy.zzz  # Replace with bot token
CHANNEL_ID=1234567890      # Replace with channel ID
USER_NAME=@xxxxxx          # Replace with your username (optional)
HOST_TO_PING=google.com  # The host to monitor
PING_INTERVAL=5            # Check interval in seconds
PING_THRESHOLD=120         # Alert threshold in milliseconds (ms)

The program will:

  1. Connect to Discord using your bot token
  2. Start monitoring ping to the specified host
  3. Send notifications when ping exceeds your threshold
  4. Update the bot's status to reflect current ping conditions

📊 How It Works

  1. The script uses ping3 library to measure network latency to a target host
  2. When latency exceeds the threshold, a Discord webhook is triggered
  3. A rich embed is sent to your specified Discord channel with ping information
  4. The Discord bot status is updated to reflect the current situation
  5. When ping returns to normal levels, the status is updated accordingly

📜 License

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

🤝 Contributing

Contributions are welcome! Feel free to open issues or submit pull requests.

🙏 Acknowledgements

🔮 Future Goals

Planned features and improvements for upcoming releases:

  • More user friendly setup and startup
  • Bot mentions discord user in high ping alert message
  • Docker container support
  • Cross-platform compatibility (Linux, Windows)

Got an idea or feature request? Feel free to open an issue


Made with ❤️ by Kexe while waiting for better ping.

About

A Python-based utility that monitors your network ping in real-time and sends alerts to Discord when latency exceeds a specified threshold.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published