fix: interval presets, back buttons, and cleaner confirmation formatting

This commit is contained in:
2026-06-17 12:39:10 +02:00
parent 075765af35
commit bfc610dd6b
+7 -6
View File
@@ -150,6 +150,7 @@ def _kw_action_keyboard(kw_id: str, is_active: bool) -> InlineKeyboardMarkup:
[InlineKeyboardButton(toggle_btn, callback_data=f"toggle:{sid}"), [InlineKeyboardButton(toggle_btn, callback_data=f"toggle:{sid}"),
InlineKeyboardButton("✏️ Edit", callback_data=f"edit_menu:{sid}")], InlineKeyboardButton("✏️ Edit", callback_data=f"edit_menu:{sid}")],
[InlineKeyboardButton("🗑 Remove", callback_data=f"remove_confirm:{sid}")], [InlineKeyboardButton("🗑 Remove", callback_data=f"remove_confirm:{sid}")],
[InlineKeyboardButton("↩ Back to Menu", callback_data="menu:")],
]) ])
@@ -289,8 +290,8 @@ async def text_input_handler(update: Update, context: ContextTypes.DEFAULT_TYPE)
kw_id = str(uuid.uuid4()) kw_id = str(uuid.uuid4())
await update.message.reply_text( # type: ignore[union-attr] await update.message.reply_text( # type: ignore[union-attr]
f'I will add this keyword to your watchlist:\n\n' f'I will add this keyword to your watchlist:\n\n'
f'<blockquote>"<b>{text}</b>"</blockquote>\n\n' f'Keyword: <b>{text}</b>\n'
f"Interval: <code>5 min</code> (default)\n\nLooks good?", f'Interval: <code>5 min</code> (default)\n\nLooks good?',
parse_mode="HTML", parse_mode="HTML",
reply_markup=_confirm_add_keyboard(kw_id), reply_markup=_confirm_add_keyboard(kw_id),
) )
@@ -306,7 +307,7 @@ async def text_input_handler(update: Update, context: ContextTypes.DEFAULT_TYPE)
encoded_name = _b64(text) encoded_name = _b64(text)
await update.message.reply_text( # type: ignore[union-attr] await update.message.reply_text( # type: ignore[union-attr]
f'New keyword name:\n\n<blockquote>"<b>{text}</b>"</blockquote>\n\nLooks good?', f'New keyword name:\n\n<b>{text}</b>\n\nLooks good?',
parse_mode="HTML", parse_mode="HTML",
reply_markup=InlineKeyboardMarkup([ reply_markup=InlineKeyboardMarkup([
[InlineKeyboardButton("✅ Yes", callback_data=f"confirm_name:{kw_id}:{encoded_name}"), [InlineKeyboardButton("✅ Yes", callback_data=f"confirm_name:{kw_id}:{encoded_name}"),
@@ -679,10 +680,10 @@ async def _handle_callback(update: Update, context: ContextTypes.DEFAULT_TYPE) -
"Enter interval in minutes (11440):", parse_mode="HTML") "Enter interval in minutes (11440):", parse_mode="HTML")
elif action == "set_interval": elif action == "set_interval":
sub_parts = payload.split(":", 2) sub_parts = payload.split(":", 1)
if len(sub_parts) < 3: if len(sub_parts) < 2:
return return
sid, minutes_str = sub_parts[0], sub_parts[2] sid, minutes_str = sub_parts[0], sub_parts[1]
try: try:
minutes = int(minutes_str) minutes = int(minutes_str)
except ValueError: except ValueError: