A relatively simple Discord bot that notifies users when an internet resource becomes accessible or inaccessible.
It uses:
- poise as its bot framework
- surge-ping for ICMP pings
The watchdog pings the selected resource at regular intervals. If the resource becomes available after an outage, the bot notifies a specified Discord role.
Originally created to monitor the BYOND Hub during persistent DDoS attacks, the bot is configured to:
- Ping users when the resource comes back online
- Only send a silent notification (no ping) when the resource goes down
Customize messages in Config.toml if you want to change this behaviour.
Configuration is managed via Config.toml in the bot's executable directory. See Config.example.toml for reference syntax.
Important
You must set the master_server setting and replace [server_configs.1159410563235822656] with [server_configs.*your_master_server_id*] (where *your_master_server_id* is the ID you set earlier). (Image).
If you configure everything correctly, your server will be automatically registered as the Master Server.
- Commands marked with
[M ONLY]can only be run on the Master Server. - If you set
max_serversto a value greater than 1, others can add your bot to their servers.- After adding it, they must use
/server registerto register their server. - They should then configure
/config roleand/config channel(optionally,/config message).
- After adding it, they must use
You can:
- Check where your bot is installed using
/server show. - Unregister individual servers or all servers with
/server remove.
Warning
After the first launch, the bot creates Data.toml to store runtime configuration.
Subsequent starts will ignore Config.toml unless you either:
- Delete
Data.toml, or - Run the
config resetcommand
All slash commands except info require MANAGE_CHANNELS (empirical choice) permissions:
| Command | Description |
|---|---|
config reset |
[M ONLY] Restores configuration to Config.toml defaults (or hardcoded defaults if absent) |
config name |
[M ONLY] Changes the monitored resource's name |
config address |
[M ONLY] Updates the monitored resource's address |
config interval |
[M ONLY] Adjusts the delay between ping attempts |
config timeout |
[M ONLY] Changes the ping attempt timeout duration |
config attempts |
[M ONLY] Changes amount of attempts, neccessary to change resource's status |
config channel |
Changes the notification channel |
config role |
Modifies the role pinged when the resource changes status |
config message |
Modifies messages, which are sent by bot on status change. Use %%RESOURCE%% and %%ROLE%% template variables |
debug logs |
[M ONLY] Sends ephemeral debug.log |
debug data |
[M ONLY] Sends ephemeral Data.toml |
info |
Displays information about the bot |
server register |
Registers current server |
server show |
[M ONLY] Shows all registered servers |
server remove |
[M ONLY] Unregisters individual server or all servers |
server limit |
[M ONLY] Changes maximum amount of registered servers |
- Download the latest release archive from GitHub.
- Extract the files to your preferred location.
- Create an application on the Discord Developer Portal. Customize the name, description, etc., if necessary (Image).
- Create a bot for this application and get your bot's
Token. It may be displayed already, or you may need to press the Reset Token button (Image). - Select the
Manage MessagesandSend Messagespermissions for your bot (Image). - Set your
TokenasDISCORD_TOKENin.env. Consider settingINTERACTIVEin.envto0, if you are running this bot on a server. - Customize
Config.tomlas needed. - Add your bot to your Discord server.
- Run the executable.
- Clone the repository from GitHub.
- Ensure you have Cargo and Rust installed.
- Build the source code using
cargo build --release. - Move the executable from
./target/releaseto your desired location. - Create an application on the Discord Developer Portal. Customize the name, description, etc., if necessary (Image).
- Create a bot for this application and get your bot's
Token. It may be displayed already, or you may need to press the Reset Token button (Image). - Select the
Manage MessagesandSend Messagespermissions for your bot (Image). - Copy
Config.example.tomlto the same location, rename it toConfig.toml, and customize it as needed. - Copy
.env.exampleto the same location, rename it to.env. Set yourTokenasDISCORD_TOKENin.env. Consider settingINTERACTIVEin.envto0, if you are running this bot on a server. - Add your bot to your Discord server.
- Run the executable.
Tip
All logs are written to both standard output and ./debug.log. For more detailed ping request information, set TRACING = 1 in your .env file to log every ping attempt. Careful: These logs can grow large quickly!
Licensed under either of Apache License, Version 2.0 or MIT license at your option.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in this crate by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.
Not affiliated with BYOND or Discord. All trademarks belong to their respective owners.
