fix: interval presets, back buttons, and cleaner confirmation formatting
This commit is contained in:
+7
-6
@@ -150,6 +150,7 @@ def _kw_action_keyboard(kw_id: str, is_active: bool) -> InlineKeyboardMarkup:
|
||||
[InlineKeyboardButton(toggle_btn, callback_data=f"toggle:{sid}"),
|
||||
InlineKeyboardButton("✏️ Edit", callback_data=f"edit_menu:{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())
|
||||
await update.message.reply_text( # type: ignore[union-attr]
|
||||
f'I will add this keyword to your watchlist:\n\n'
|
||||
f'<blockquote>"<b>{text}</b>"</blockquote>\n\n'
|
||||
f"Interval: <code>5 min</code> (default)\n\nLooks good?",
|
||||
f'Keyword: <b>{text}</b>\n'
|
||||
f'Interval: <code>5 min</code> (default)\n\nLooks good?',
|
||||
parse_mode="HTML",
|
||||
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)
|
||||
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",
|
||||
reply_markup=InlineKeyboardMarkup([
|
||||
[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 (1–1440):", parse_mode="HTML")
|
||||
|
||||
elif action == "set_interval":
|
||||
sub_parts = payload.split(":", 2)
|
||||
if len(sub_parts) < 3:
|
||||
sub_parts = payload.split(":", 1)
|
||||
if len(sub_parts) < 2:
|
||||
return
|
||||
sid, minutes_str = sub_parts[0], sub_parts[2]
|
||||
sid, minutes_str = sub_parts[0], sub_parts[1]
|
||||
try:
|
||||
minutes = int(minutes_str)
|
||||
except ValueError:
|
||||
|
||||
Reference in New Issue
Block a user