Plex Assistant for Telegram Setup Guide
A guide to get my Plex Assistant Bot for Telegram setup to use with Radarr/Sonarr and Telegram.
0.0 - REQUIREMENTS
- Python 3.x
- A Telegram account
At least one of:
- Sonarr (on the same host as the bot)
- Radarr (on the same host as the bot)
1.0 - Telegram
1.1 - Creating the Bot
The first thing we need to do is create a bot in Telegram. This can easily be done within the Telegram application by contacting the Telegram-hosted Bot, Botfather. You just need to type
@botfather into the search bar, or just click here to open a chat with the bot.
Once contacted, type
/newbot to start the process of creating a new bot. Chose a name, a username, and that's it! Your bot has been created! Note the API token that Botfather will send.
You can use
/mybots to change things such as the bot photo, description, etc. You can also fetch the bot token from here if you ever lose it.
1.2 - Getting your Chat ID
The easiest way to get your Telegram chat ID, which is needed to ensure you can be registered as an admin, is to contact the bot,
@getidsbot, or just click here.
Once contacted and started, type
/about to get a print out of information. The key piece in the tree is Message->from->id, which should be a 7~10 length integer. Note this chat ID for future use.
2.0 - Bot Setup
Download or clone the GitHub repository (located here) into a folder that is easily accessible.
2.1 - Config.ini
Within the bot, there is only one file that needs to be edited, and that is within the
data folder. Copy (or move)
config.ini in the same folder. Open the file, and we can start filling in the required details.
2.1.1 - General
NAME: Self-explanatory, but you can change the name of the bot if you like. It is currently only used in the registration process, but may be used in other cases in the future.
2.1.2 - Notifications
TIME: Time in 24h format,
HH:MMwhich is the time that daily reports will be sent out; uses host machine's local timezone
DATE: Day of the week that weekly reports will be sent out, at the same time as daily reports
2.1.3 - Telegram
BOT_TOKEN: In 1.1, we got the Telegram bot token, and that goes here
AUTO_ADMINS: In 1.2, we got our chat ID, and that goes here
AUTO_APPROVE: Can be
no, determines if new users will be automatically approved/verified on registration
2.1.4 - Sonarr
ENABLED: Can be
HOST: The host for Sonarr, without the trailing slash
API: Sonarr's API key obtained from its web UI
UPDATE_FREQ: Frequency in minutes that the bot will update its own local database of shows in Sonarr
2.1.5 - Radarr
ENABLED: Can be
HOST: The host for Radarr, without the trailing slash
API: Radarr's API key obtained from its web UI
UPDATE_FREQ: Frequency in minutes that the bot will update its own local database of movies in Radarr
2.1.6 - Ombi
ENABLED: Can be
HOST: The host for Ombi, without the trailing slash
API: Ombi's API key obtained from its web UI
Currently, Ombi implementation does nothing, but will be used in the future, so it doesn't hurt to set it up now.
3.0 - Setting up Sonarr/Radarr
Open the web UI for Sonarr or Radarr, and go to Settings->Connect->"+", then chose custom script.
Add a name for the script, disable "On Grab" and "On Rename".
The path is the path to Python, not the script.
In arguments, type the path in quotes to the respective script which are located at the root of the bot directory. Do not move the scripts, as it uses relative locations to find the database.
4.0 - Starting the Bot
If you have multiple versions of Python installed (Python 2 and Python 3 for example),
pipis specific to each version. In my examples below, I used
pip3since I have both versions installed and the bot is written using Python 3, ensure you use Python 3's version of
Before we can start, we have to quickly install the prerequisites using PIP for the bot to run. In the root directory of the bot, run
pip3 install -r docs/requirements.txt which will install the few required modules needed.
If all has been completed and went well, enter the bot directory in a terminal window, and type
python3 start.py to start the bot. If no red error messages are shown, the bot has started and will have started updating its local SQLite database with the media content from Sonarr and/or Radarr.
You can now start your bot by either searching for the bot username in the search bar, or by tapping the link supplied in Botfather. If all went well, on start you should be greeted with the registration process!
Assuming you got the correct chat ID, you will automatically be registered as an admin of the bot on completion of registration. You can (and any other users) type
/help to see a list of commands respective to each user type.