telegram_bot
Functions
Factory function to initialize and connect the TelegramBot. |
Classes
A Telegram Bot for controlling and monitoring the village system. |
- class TelegramBot[source]
Bases:
TelegramBotBaseA Telegram Bot for controlling and monitoring the village system.
- token
The Telegram bot token.
- Type:
str
- chat
The chat ID to send alarms to.
- Type:
str
- message
Current message buffer.
- Type:
str
- connected
Connection status.
- Type:
bool
- error_running
Flag indicating if an error occurred during the loop.
- Type:
bool
- error
Error message.
- Type:
str
- thread
Background thread for the bot loop.
- Type:
threading.Thread
- application
The python-telegram-bot application instance.
- Type:
Application
- async start(update: telegram.Update, context: telegram.ext.ContextTypes.DEFAULT_TYPE) None[source]
Responds to the /start command.
- Parameters:
update (Update) – The update object.
context (ContextTypes.DEFAULT_TYPE) – The context object.
- alarm(message: str) None[source]
Sends an alarm message to the configured chat.
- Parameters:
message (str) – The message content.
- async report(update: telegram.Update, context: telegram.ext.ContextTypes.DEFAULT_TYPE) None[source]
Generates and sends a report for the specified number of hours.
- Parameters:
update (Update) – The update object.
context (ContextTypes.DEFAULT_TYPE) – The context object (contains args).
- async cam(update: telegram.Update, context: telegram.ext.ContextTypes.DEFAULT_TYPE) None[source]
Takes pictures from cameras and sends them.
- Parameters:
update (Update) – The update object.
context (ContextTypes.DEFAULT_TYPE) – The context object.
- async plot(update: telegram.Update, context: telegram.ext.ContextTypes.DEFAULT_TYPE) None[source]
Generates and sends a plot of corridor events.
- Parameters:
update (Update) – The update object.
context (ContextTypes.DEFAULT_TYPE) – The context object.
- async main() None[source]
Main asyncio loop for the bot application.
- async botloop_starttask() None[source]
Starts the main bot task.
- botloop() None[source]
Entry point for the bot thread.
- get_telegram_bot() TelegramBotBase[source]
Factory function to initialize and connect the TelegramBot.
- Returns:
An initialized TelegramBot instance or base class on failure.
- Return type: