verif_processing¶
Attributes¶
Logger for the Queue Process 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. |
|
Parse mode set to HTML for formatting Telegram messages. |
|
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 reminder message to a user, prompting them to respond to a verification message. |
|
Sends an alert message to a user's emergency contacts if the user fails to respond. |
|
Continuously checks for user responses and manages the reminder and alert system. |
Module Contents¶
- logger¶
Logger for the Queue Process 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.
- P_HTML¶
Parse mode set to HTML for formatting Telegram messages.
- WAITING_TIME = 9¶
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_reminder(user_id: int, username: str, reminder_count: int) telegram.Message ¶
Sends a reminder message to a user, prompting them to respond to a verification message.
- Parameters:
user_id (int) – The Telegram user ID to send the message to.
username (str) – The username of the user for logging purposes.
reminder_count (int) – The count of the reminder being sent.
- Returns:
The Telegram message object representing the sent reminder.
- Return type:
Message
- async send_alert_message(user_id: int, verif_time: datetime.datetime.time, desc: str) telegram.Message ¶
Sends an alert message to a user’s emergency contacts if the user fails to respond.
- Parameters:
user_id (int) – The Telegram user ID to alert.
verif_time (datetime.time) – The time when the verification was supposed to occur.
desc (str) – Description provided for the callback.
- Returns:
The Telegram message object sent to the user after alerting their contacts.
- Return type:
Message
- async check_for_response() None ¶
Continuously checks for user responses and manages the reminder and alert system.
This function runs an infinite loop that checks for user responses to scheduled verification messages. If a response is not received within the set waiting time, it sends reminders. If the user fails to respond after several reminders, it sends alerts to emergency contacts.
The function also manages the queue of users to be checked and updates their status accordingly.