From 6d4133a04d79b3313c352e536788333af491d4f8 Mon Sep 17 00:00:00 2001 From: Dmitrii Morozov Date: Fri, 21 Jun 2024 20:17:43 +0200 Subject: Reworked statistics --- telegram_bot/__init__.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'telegram_bot/__init__.py') diff --git a/telegram_bot/__init__.py b/telegram_bot/__init__.py index 5e3d455..0818d67 100644 --- a/telegram_bot/__init__.py +++ b/telegram_bot/__init__.py @@ -10,6 +10,10 @@ class CommandHandler: async def handle(self, message: telebot.types.Message): pass +class CallbackQueryHandler: + async def handle(self, call: telebot.types.CallbackQuery): + pass + class TelegramBot: __bot: AsyncTeleBot __user_repository: UserRepository @@ -35,6 +39,11 @@ class TelegramBot: command_handler.handle, commands=[ command ]) + def register_callback_query(self, callback_query_handler: CallbackQueryHandler, filter: typing.Callable): + self.__bot.register_callback_query_handler( + callback=callback_query_handler.handle, + func=filter) + async def send_message_to_all(self, message_text: str): for user in self.__user_repository.get_all_users(): try: @@ -47,8 +56,9 @@ class TelegramBot: if 'bot was kicked from the group chat' in str(error): self.__user_repository.remove_chat(user[0]) - async def reply(self, message, message_text): + async def reply(self, message, message_text, reply_markup = None): await self.__bot.reply_to( message, message_text, + reply_markup=reply_markup, parse_mode='MarkdownV2') \ No newline at end of file -- cgit v1.2.3