scheduler¶
Attributes¶
Logger for the scheduler service module |
|
The API token for the Telegram bot, retrieved from the configuration file. |
|
The username of the Telegram bot, retrieved from the configuration file. |
|
The default waiting time (in minutes) before sending the next reminder. |
|
The Telegram bot object used to send messages and interact with users. |
Functions¶
|
Sends a daily scheduled message to the user, prompting them to confirm their status. |
|
Runs the main scheduling loop, sending daily messages at the specified time for each user. |
Module Contents¶
- logger¶
Logger for the scheduler service module
- API_TOKEN¶
The API token for the Telegram bot, retrieved from the configuration file.
- BOT_USERNAME¶
The username of the Telegram bot, retrieved from the configuration file.
- WAITING_TIME = 8¶
The default waiting time (in minutes) before sending the next reminder.
- bot¶
The Telegram bot object used to send messages and interact with users.
- async send_daily_message(user_id: int, username: str, verif_time: datetime.datetime.time, description: str) telegram.Message ¶
Sends a daily scheduled message to the user, prompting them to confirm their status.
- Parameters:
user_id (int) – The Telegram user ID to send the message to.
username (str) – The username of the user for logging purposes.
verif_time (datetime.time) – The scheduled time for the verification message.
description (str) – A description associated with the daily message.
- Returns:
The Telegram message object representing the sent daily message.
- Return type:
Message
- async run_schedule() None ¶
Runs the main scheduling loop, sending daily messages at the specified time for each user.
This function checks the current time every minute and sends messages to users when their scheduled verification time matches the current time. If the verification is skipped or marked as a fast-check, it updates the user’s status accordingly.