This is a telegram bot that can command line commands and some utilities.
Running this on any machine you can also upload and download files with the inline keyboard explorer.
Printing is also available through pycups.
Basic permissions can be configured using the bot.properties file.
This bot needs python 3.6 or higher
Install the dependencies:
sudo apt install python3-pip
pip3 install python-telegram-bot --upgrade
pip3 install requests
# Optional
sudo apt-get install libcups2-dev
pip3 install pycups
Create a bot using the botfather
Run using the TOKEN:
python3 run_bot.py 'TOKEN GOES HERE' mybot
Or create a bot.properties file, use the bot.properties.example to see available options:
python3 run_bot.py
Then send a command /start to the bot to get admin rights, all other users are ignored.
Prints this readme.
Browses the file system using inline keyboard. It is possible to download files or set the current directory to upload by sending documents.
Prints all commands in the format required by botfather for autocomplete.
Gets the local ip.
Gets the external ip.
Sends back an image (for testing purposes)
Gets admin rights if no admin is already registered. If you were added as admin, updates the chat id associated with the user.
Returns your user id
Returns your chat id
Prints the last document sent to the machine printer using cups.
Executes a shell command.
example:
/exec ls
Executes a shell command async.
example:
/exec wget http://www.example.com/foo.zip
Sends back the image on path
example:
/img /home/user/image.png
Send a message to all admins
example:
broadcast this is a test
Runs a sql query on bot sqlite db.
example:
sql SELECT * FROM msg_received
Does a get request and prints the returned body.
Protocol (http or https) is required
example:
/get https://icanhazip.com/
Gets a file from a path or from current dir example:
/down /home/user/foo.txt
/down foo.txt
Stores and recovers values from a map.
example:
/store foo hello world
/value foo
Every contact sent by an admin also becomes an admin
Every file is saved on the "current dir" folder. To get the file use command /down