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.
CoherentUI_Host.exe
processes (requires admin rights)cmd.exe netstat -aon
and find the PID its outputIf the process is running, but its PID is no longer found in the output of netstat
it then does the following:
cmd /C shutdown /s
)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) |
BotFather
/newbot
and follow instructions. If successful, you will receive the bot id and token (in the form of <botid:token>
).telegram.me/<bot_username>
in your browserhttps://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.config.yml
and copy the bot id, token and chat id in the corresponding fields. Done!If you want to compile this program yourself you will need the following programs/tools:
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.
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.
MIT