Tutor Telegram Bot is a telegram bot that manages educational material ads and posts them on a given channel. After a given period, it automatically deletes this post in the telegram channel.
To use this bot, you need Windows or Linux, an internet connection and Python (tested on Windows 10 and Python version 3.10.4).
To download Python:
- Go to the official python website;
- Choose Downloads;
- In the "Looking for a specific release?" section, choose the Python version you want, but it's recommended to use the same version of Python that was used during development and testing;
- Scroll to the bottom of the page and in the "Files" section, choose Windows installer for 32-bit or 64-bit system (guide to check if PC is running in 64-bit or 32-bit Windows version);
- After downloading, open this file, check the "Add Python 3.10 to path" check box and follow the instructions.
For Windows:
To install all required python libraries, just run (click on) setup.cmd and wait until it says Press any key to continue.
For Linux:
To install all required python libraries grant executable permissions for setup.sh file, run it and wait until it says Press any key to continue.
To set up Tutor Telegram Bot, go to the data directory where you will see bot_config.py, logging_config.py and message_config.py files.
-
bot_config.pyis a main configuration file. There you should edit next things:-
INSP_API_IDandINSP_APP_HASHare app details received from an official website of Telegram.
You will need to login into your telegram account and create an app. After you create an app, you should see something like this:Now you can put "App api_id" into
INSP_API_IDand "App api_hash" intoINSP_APP_HASH. -
TOKENis a bot token you can get through the officially implemented telegram bot. To create a new bot type or choose command/newbot, answer all questions, and you should see something like this:Now you can copy the token and put it into
TOKENfield. Also, remember to add this bot to your admin group in your telegram channel. -
For the next move, you should have LiqPay business account. After you've done setting up your LiqPay account, go to the API tab, where you should see something like this:
LIQPAY_STRIPE_TOKENis another token you can get through @BotFather. Type or choose command/mybots, then go to the bot you've created in step #2. There you should go to Payments and search for LiqPay. After you click on the LiqPay button, click on Connect LiqPay Live button. You should be redirected to LiqPay official bot. Copy the Public key you got from the LiqPay site and send a command like this:
/mykey_i************(Where i*********** should be your Public key)
After you do this, you should find out that your Payments tab in @BotFather has been renewed.Now you can copy that token and put it into
LIQPAY_STRIPE_TOKENfield. -
TELEGRAM_CHANNEL_IDis a channel id you can get through the Telegram Web. There you should go to your telegram channel, and in the URL bar, you should see something like this:Copy @******** (e.g. @u_now_ua like on the photo above) and put it into
TELEGRAM_CHANNEL_IDfield. In the end, it should look like this:
TELEGRAM_CHANNEL_ID = '@********' -
DONATIONcan beTrueorFalse. IfDONATIONisTrue, you need to provide a URL to your Monobank Банка.
-
FREEdetermines whether material posts are free or not. It can beTrueorFalse. If it isFalse, you need to provide the desired price inPOST_PRICEfield.
Other constants inside the
bot_config.pyfile are already provided. You can change them ONLY if you totally understand what they do. -
-
message_config.pyis about all messages inside the telegram bot. If you want to change the look or the content of some messages, you can freely do so*.
*But not theFINAL_VARIANT_MESSAGE_1orADD_ANOTHER_MESSAGE. They have a specific structure that you should follow:- For
FINAL_VARIANT_MESSAGE_1, {subject_name}, {subject_idea}, {material_format}, {material_level}, {material_description}, {material_price}, {username} and {material_hashtag} MUST be there; - For
ADD_ANOTHER_MESSAGE, {n} MUST be there.
- For
-
Do not touch
session_string.pyfile. It will be generated once you launch the bot for the first time. It contains your telegram credentials, so DO NOT SHARE THIS FILE WITH ANYBODY. -
logging_config.pyfile is about logging everything. Please, only touch this file if you are familiar with the python logging library.
For Windows:
To start the telegram bot, just run (click on) run.cmd file.
For Linux:
To start the telegram bot, grant executable permissions to run.sh file and run it.
For the first time you will run run.cmd or run.sh files, you will be asked for your telegram phone number and password.
Please, do not worry, your credential don't go anywhere but to telegram and are stored like hash inside the
session_config.pyfile. So if nobody has access to this file, nobody apart from you won't have access to your telegram account.
The script automatically schedules the inspector task, which deletes expired posts.
To stop the telegram bot click on the command prompt (or terminal for Linux) and press Ctrl-C.
After that, you will be asked whether you want to delete the inspector task or not:
If you want to delete this task, press y and then ENTER; if you do not want to delete it, press n and ENTER.





