add timers 1 2 3 6 12 24 hours
This commit is contained in:
parent
13a83b9fbd
commit
3f5f4f14b9
2 changed files with 18 additions and 3 deletions
|
|
@ -756,7 +756,14 @@ class LichessBot:
|
||||||
if period == 0:
|
if period == 0:
|
||||||
button_text = t('disable_notifications', lang)
|
button_text = t('disable_notifications', lang)
|
||||||
else:
|
else:
|
||||||
button_text = t('period_minutes', lang, period=period)
|
# Format period text: minutes for < 60, hours for >= 60
|
||||||
|
if period < 60:
|
||||||
|
button_text = f"⏰ {period} minutes"
|
||||||
|
elif period == 60:
|
||||||
|
button_text = "⏰ 1 hour"
|
||||||
|
else:
|
||||||
|
hours = period // 60
|
||||||
|
button_text = f"⏰ {hours} hours"
|
||||||
keyboard.append([InlineKeyboardButton(button_text, callback_data=f"period_{period}")])
|
keyboard.append([InlineKeyboardButton(button_text, callback_data=f"period_{period}")])
|
||||||
|
|
||||||
reply_markup = InlineKeyboardMarkup(keyboard)
|
reply_markup = InlineKeyboardMarkup(keyboard)
|
||||||
|
|
@ -796,8 +803,16 @@ class LichessBot:
|
||||||
t('notifications_disabled', lang, username=active_gamer['username'])
|
t('notifications_disabled', lang, username=active_gamer['username'])
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
|
# Format period text for confirmation message
|
||||||
|
if period < 60:
|
||||||
|
period_text = f"{period} minutes"
|
||||||
|
elif period == 60:
|
||||||
|
period_text = "1 hour"
|
||||||
|
else:
|
||||||
|
hours = period // 60
|
||||||
|
period_text = f"{hours} hours"
|
||||||
await query.edit_message_text(
|
await query.edit_message_text(
|
||||||
t('period_set', lang, period=period, username=active_gamer['username'])
|
f"✅ Period {period_text} set for {active_gamer['username']}\n📱 Notifications will be sent to personal messages"
|
||||||
)
|
)
|
||||||
|
|
||||||
# Start periodic task for this gamer (send to user's personal messages)
|
# Start periodic task for this gamer (send to user's personal messages)
|
||||||
|
|
|
||||||
|
|
@ -31,7 +31,7 @@ def _resolve_database_path() -> str:
|
||||||
DATABASE_PATH = _resolve_database_path()
|
DATABASE_PATH = _resolve_database_path()
|
||||||
|
|
||||||
# Period options for /setperiod command
|
# Period options for /setperiod command
|
||||||
PERIOD_OPTIONS = [0, 15, 30, 60, 120, 180] # minutes
|
PERIOD_OPTIONS = [0, 15, 30, 60, 120, 180, 360, 720, 1440] # minutes (0=disable, then: 15min, 30min, 1h, 2h, 3h, 6h, 12h, 24h)
|
||||||
|
|
||||||
# Telegram Bot Long Polling Configuration
|
# Telegram Bot Long Polling Configuration
|
||||||
POLL_INTERVAL = 1.0 # seconds
|
POLL_INTERVAL = 1.0 # seconds
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue