A Telegram bot for running and managing tasks on a Raspberry Pi. Mostly built for my use but you can modify the code to your liking.
- Runs common shell commands
- Automated subtitle downloading for torrents
- Automatic proxy management via site scraping (if Telegram is inaccessible in your location)
- Downloading audio from YouTube
- Remote code updating using
git pull
- Modular design for further enhancements
- Independent configurations for easy integration
mdl
: Download audio from YouTube and embed metadata using gTaggervdl
: Download video from YouTuberms
: Reboot MiniDLNA serverstatus
: Check the status of the botreboot
: Reboot the deviceupd
: Update code (Pull from remote repo)lms
: List the media available in media server directorypbd
: Clear base directoryupx
: Fetch a new proxyqbt
: Download torrents using qBittorrent
- Adjust the settings in
config.tmpl.json
for your Pi and rename it toconfig.json
. Setbot_token
to your bot's API token. Setmaster_chat_id
to your primary chat that will receive uninitiated messages (e.g., torrent updates). - Instructions here. Only follow instructions for receiving your Chat ID and API token.
- Use any torrent client. I use qBittorrent with RSS feeds setup for automated downloading. Set your client to run
torrent_module.py <path-to your-download>
when a torrent is finished downloading. It'll scan the download directory for video files and move them to your mediaserver location. - If the path to the file contains
subs_download_directory
, it will also softcode subtitles into the video file before moving it to the server, after waiting forsubs_wait_period
seconds. - Anybody can send a command to the bot. The bot only sends uninitiated messages to
master_chat_id
. - Set the
use_proxy
flag if you want the bot to use a proxy. You can specify theproxy_url
or let the bot find one itself using theupx
command or just call theupdate_proxy
method insideproxy_manager.py
. base_directory
serves as the root folder where the bot will operate.media_server_directory
andsubs_download_directory
will be inside this folder.- Additionally, use gTagger to automatically embed metadata to music downloaded from YouTube. Set
genius_api_token
to your Genius.com API token.