Skip to content

Commit

Permalink
keyboard reply fix
Browse files Browse the repository at this point in the history
  • Loading branch information
markusressel committed Sep 27, 2024
1 parent c528099 commit 2661861
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion keel_telegram_bot/bot/reply_keyboard_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ async def await_user_selection(self, update: Update, context: CallbackContext,
"callback_data": callback_data,
})
await send_message(bot, chat_id, text, parse_mode="MARKDOWN", reply_to=message_id, menu=keyboard)
self.awaiting_response[user_id] = self.awaiting_response[user_id]["popup_sent"] = True

def await_response(self, user_id: str, options: List[str], callback_data: dict, callback):
"""
Expand All @@ -99,9 +100,11 @@ def await_response(self, user_id: str, options: List[str], callback_data: dict,
:param callback_data: data to pass to callback
"""
if user_id in self.awaiting_response:
raise AssertionError("Already awaiting response to a previous query from user {}".format(user_id))
if self.awaiting_response.get(user_id, {}).get("popup_sent", False):
raise AssertionError("Already awaiting response to a previous query from user {}".format(user_id))

self.awaiting_response[user_id] = {
"popup_sent": False,
"valid_responses": options,
"callback": callback,
"callback_data": callback_data
Expand Down

0 comments on commit 2661861

Please sign in to comment.