Skip to content

Introducing my Telegram Bot for Remote PC Monitoring and Control: telegram-remote-bash

Sunday, 28 May 2023 | Andrea Del Sarto


Hello, Tech enthusiasts! I am beyond excited to introduce to you my first project on GitHub – a Bash-based Telegram Bot that allows you to monitor and control a remote computer!

The idea behind this bot is pretty simple, yet powerful – you can command your PC, retrieve important system information, perform updates and even control system processes directly from your Telegram app. I’ve designed this bot with KDE Neon in mind, but it can be adapted to other Linux-based systems.

Here’s a sneak peek into some of the key functionalities provided by the bot:

function getBattery {
local percentage=$(upower -i /org/freedesktop/UPower/devices/battery_BAT0 | grep percentage | awk ‘{print $2}’)
echo “Battery level: $percentage”
}

function getCpuUsage {
local usage=$(top -bn1 | grep “Cpu(s)” | \
sed “s/.*, *([0-9.])% id.*/\1/” | \
awk ‘{print 100 – $1″%”}’)
echo “CPU Usage: $usage”
}

The bot responds to a set of predefined commands that range from simple system status checks like /battery, /status, /uptime, /memory, /disk, /cpu_usage to more complex functionalities such as /shutdown, /upgrade, /screenshot, and so on.

For the bot to run, it requires some prerequisites like curl, jq, bc among others. Some commands also require specific programs to be installed on your system.

The code is still in its initial version (0.1) and there might be some bugs on certain commands. But I am enthusiastic about making it better with every iteration. Future enhancements include multi-language support and other features based on user feedback.

I encourage you to give it a try, and would greatly appreciate your feedback. Feel free to report any issues, or suggest enhancements on the project’s GitHub page.

Here’s the link to the project on GitHub: telegram-remote-bash

Happy Coding!