BDO-Watchdog
BDO-Watchdog copied to clipboard
A monitoring tool for Black Desert Online with Telegram messaging support
BDO Watchdog 
A simple Go program that monitors the BlackDesert64.exe process and its network status. If the process disconnects it sends a custom Telegram message and optionally kills the process or turns off the computer.
Screenshot
How it works
- (optionally) Tries to kill all
CoherentUI_Host.exe
processes (requires admin rights) - (optionally) Changes the CPU process priority on startup (requires admin rights)
- Check if the designated process is currently running
- Obtain the process ID (PID)
- Run
cmd.exe netstat -aon
and find the PID its output
If the process is running, but its PID is no longer found in the output of netstat
it then does the following:
- Send a Telegram message using a URL query string
- (optionally) writes the time of disconnect in a log file
- (optionally) tries to kill the process (requires admin rights)
- (optionally) shuts down the computer (
cmd /C shutdown /s
)
Configuration
On first startup the program creates the config.yml
file, where you can provide the details of your Telegram bot. It also contains some program specific options.
Option | Description |
---|---|
token | The token is a string along the lines of AAHdqTcvCH1vGWJxfSeofSAs0K5PALDsaw that is required to authorize the bot |
botid | A unique ID of your bot along the lines of 123456789 |
chatid | Unique identifier for the target chat or username of the target supergroup or channel |
timestamp | Append a timestamp to the Telegram message |
message | The message your bot sends in case of a disconnect |
stayalive | By default, the program closes if it has detected a disconnect |
process | The process to be monitored, defaults to BlackDesert64.exe |
timebetweenchecksins | Time in seconds to wait between each polling interval |
faillimit | Maximum number of failed checks until exit routine is initiated |
shutdownondc | Shut down the computer after the client disconnected |
killondc | Kill the process after it disconnected (requires the executable to be run with admin rights!) |
killcoherentui | Kill all CoherentUI_Host.exe processes (requires admin rights) |
log | Write a simple log file with timestamps (log.txt file) |
processpriority | Set the CPU priority of the process (allowed values: idle, below normal, normal, above normal, high priority, realtime ) (requires admin rights) |
Setting up the Telegram Bot
- Download Telegram for your favorite platform
- Initiate chat with the
BotFather
- Enter
/newbot
and follow instructions. If successful, you will receive the bot id and token (in the form of<botid:token>
). - Initiate a conversation with your bot by entering
telegram.me/<bot_username>
in your browser - Retrieve your personal user/chat id by entering
https://api.telegram.org/bot<BOT_ID>:<TOKEN>/getUpdates
. You will see a JSON object that contains"from":{"id":12345678,[...]"
. The id is the chat id you will need. - Finally, open
config.yml
and copy the bot id, token and chat id in the corresponding fields. Done!
Compiling BDO Watchdog from source
If you want to compile this program yourself you will need the following programs/tools:
- Go
- (optional) JetBrains Gogland IDE
- Mingw-w64
- (optional) rcedit
If everything is set up correctly and all executables are in PATH
clone this repository, open a command shell in the root directory and enter make
. Alternatively, you can also just run go build
, but then the command shell window will not be hidden and the executable will not have a fancy icon.
Contributing
This is a free time project as a means to learn the Go language and not some elaborate venture. By that, I cannot promise any updates or bugfixes. Feel free to fork this project and/or to suggest changes via pull requests.
Licence
MIT