webhook_telegram_bot.plugins.base

This file contains abstarct plugin class.

Module Contents

Classes

AbstractPlugin

Abstract class for plugin subclassing.

class webhook_telegram_bot.plugins.base.AbstractPlugin(app: aiohttp.web.Application)

Bases: abc.ABC

Abstract class for plugin subclassing.

abstract get_package_loader(self) Dict[str, jinja2.PackageLoader]

Return loader bounded to prefix.

Returns

dict of loaders where each loader is bound to a prefix

abstract is_known_command(self, command: str) bool

Return True if command refers to a plugin.

Parameters

command – incoming text from Telegram chat

Returns

True if command refers to a plugin.

abstract async handle_telegram_command(self, app: aiohttp.web.Application, chat_id: int, command: str) Optional[aiohttp.web.Response]

Abstract method to override.

Parameters
  • app – application instance

  • chat_id – chat identification number

  • command – incoming text from Telegram chat

Returns

bot response

abstract get_menu_button(self) List[Dict[str, Any]]

Abstract method to override.

Returns

inline keyboard structure