diff options
Diffstat (limited to 'telegram_bot')
-rw-r--r-- | telegram_bot/__init__.py | 3 | ||||
-rw-r--r-- | telegram_bot/commands.py | 5 |
2 files changed, 5 insertions, 3 deletions
diff --git a/telegram_bot/__init__.py b/telegram_bot/__init__.py index c25af95..a50c71b 100644 --- a/telegram_bot/__init__.py +++ b/telegram_bot/__init__.py @@ -47,12 +47,13 @@ class TelegramBot: async def answer_callback_query(self, callback_query_id): await self.__bot.answer_callback_query(callback_query_id=callback_query_id) - async def send_message_to_all(self, message_text: str): + async def send_message_to_all(self, message_text: str, reply_markup = None): for user in self.__user_repository.get_all_users(): try: await self.__bot.send_message( user[0], message_text, + reply_markup=reply_markup, parse_mode='MarkdownV2' ) except Exception as error: diff --git a/telegram_bot/commands.py b/telegram_bot/commands.py index 697d1e3..9c12d97 100644 --- a/telegram_bot/commands.py +++ b/telegram_bot/commands.py @@ -80,7 +80,8 @@ class GetStatsCallbackQueryHandler(CallbackQueryHandler): await self.reply_with_stats_days_difference(call.message, __duration_week__) elif call.data == __stats_month__: await self.reply_with_stats_days_difference(call.message, __duration_month__) - await self.__telegram_bot.answer_callback_query(callback_query_id=call.id) + + await self.__telegram_bot.answer_callback_query(callback_query_id=call.id) async def reply_with_today_stats(self, message): friends = await self.__fortnite_client.get_friends() @@ -117,7 +118,7 @@ class GetStatsCommand(CommandHandler): self.__telegram_bot.register_callback_query( GetStatsCallbackQueryHandler(self.__telegram_bot, self.__fortnite_client, self.__stats_repository), - lambda call: True) + lambda call: call.data == __stats_now__ or call.data == __stats_day__ or call.data == __stats_week__ or call.data == __stats_month__) async def handle(self, message: telebot.types.Message): await self.__telegram_bot.reply(message, 'Which statistics would you like to see?', reply_markup=self.__reply_markup) |