fix: cancel shows main menu greeting instead of 'Cancelled.'

This commit is contained in:
2026-06-17 12:41:23 +02:00
parent bfc610dd6b
commit 0634755e6b
+8 -2
View File
@@ -532,10 +532,16 @@ async def _handle_callback(update: Update, context: ContextTypes.DEFAULT_TYPE) -
elif action == "cancel": elif action == "cancel":
context.user_data.clear() context.user_data.clear()
kb = _main_menu_keyboard() kb = _main_menu_keyboard()
name = update.effective_user.first_name or "there" # type: ignore[union-attr]
try: try:
await query.edit_message_text("Cancelled.", reply_markup=kb, parse_mode="HTML") await query.edit_message_text(
f"Hello <b>{name}</b>! I'll notify you about new willhaben listings.",
parse_mode="HTML", reply_markup=kb)
except Exception: except Exception:
await context.bot.send_message(chat_id=chat_id or user["telegram_id"], text="Cancelled.", reply_markup=kb) await context.bot.send_message(
chat_id=chat_id or user["telegram_id"],
text=f"Hello <b>{name}</b>! I'll notify you about new willhaben listings.",
parse_mode="HTML", reply_markup=kb)
# ════════════════════════════════════════════════════════════════════ # ════════════════════════════════════════════════════════════════════
# ADD KEYWORD FLOW # ADD KEYWORD FLOW