Library for writing task based telegram bots
Library to setup telegram bots with recurring tasks.
pip install telegram-task-bot
ALLOWED_USERSspecifies the users which are allowed, if
any, every one is allowed to use the bot.
BOT_TOKENthe token of the bot.
START_MESSAGEthe message to be send as response to the start command.
There are several classes included in this Package.
Base class for recurring tasks.
job_name: strName of the job defined in this task
disable_notifications: boolDisable notifications, flag send to the telegram server
generic: boolDefines if the task looks the same for each user
first_time:timeFirst time to run the task, 0 is now takes a
repeat_time: timedeltaDefines the time between two executions of the job, takes
filename: strFilename under which data specific to this job should be saved
More specific class which adds the possiblity to get the actual value and implements user handling.
The data is saved to a
The callback method (
callback(self, context: telegram.ext.CallbackContext)) must be implemented.
Extension of the
GenericTask to simplify the usage for jobs calling a URL and returning the link/ response to the subscribers.
It retries every 2 seconds until it gets a response.
This class adds a
url field where the information lies.
handle_response(self, response: Response) must be implemented to extract the data from the request and return the message string.
Release history Release notifications | RSS feed
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.