webhook_telegram_bot.telegram.telegram_api
This file contains TelegramAPI class.
Module Contents
Classes
This class wraps Telegram API. |
Attributes
- webhook_telegram_bot.telegram.telegram_api.logger
- webhook_telegram_bot.telegram.telegram_api.lock
- class webhook_telegram_bot.telegram.telegram_api.TelegramAPI(telegram_api_endpoint: str, token: str, disable_notification: bool = True)
This class wraps Telegram API.
- async command(self, command: str, payload: Dict[str, Any]) Dict[str, Any]
Send command to Telegram API.
- Parameters
command – any command to Telegram API
payload – payload of command
- Returns
response data of Telegram server
- async set_webhook(self, url_webhook: str) None
Set webhook.
- Parameters
url_webhook – https url where telegram will send updates to bot
- Returns
None
- async delete_webhook(self) None
Delete webhook.
- Returns
None
- async send_message(self, **kwargs: Union[str, int, bool]) Dict[str, Any]
Send text message.
- Parameters
kwargs – chat_id text
- Returns
response data of Telegram server
- static send_message_as_response(**kwargs: Union[str, int, bool, Dict[str, str], Dict[str, List[List[Dict[str, str]]]]]) aiohttp.web.Response
Send text message as response.
- Parameters
kwargs –
- Returns
- static get_text(data: Dict[str, Any]) Optional[str]
Return text from Telegram request.
- Parameters
data –
- Returns
- static get_chat_id(data: Dict[str, Any]) Optional[int]
Return chat id from Telegram request.
- Parameters
data –
- Returns