forked from zovos/bot_tg
feat: /matches without args shows list of available leagues
This commit is contained in:
parent
e014019912
commit
481965e8f2
1 changed files with 21 additions and 2 deletions
23
main.py
23
main.py
|
|
@ -1234,14 +1234,33 @@ async def handle_matches_cmd(message: Message):
|
|||
raw_text = message.text or ""
|
||||
parts = raw_text.split(maxsplit=1)
|
||||
sport_alias = parts[1].strip().lower() if len(parts) > 1 else None
|
||||
if sport_alias and sport_alias not in config.ODDS_SPORTS:
|
||||
|
||||
# Если лига не указана — показать список
|
||||
if not sport_alias:
|
||||
labels = {
|
||||
"epl": "⚽ EPL (Англия)",
|
||||
"ucl": "⚽ Champions League",
|
||||
"laliga": "⚽ La Liga (Испания)",
|
||||
"bundesliga": "⚽ Bundesliga (Германия)",
|
||||
"seriea": "⚽ Serie A (Италия)",
|
||||
"ligue1": "⚽ Ligue 1 (Франция)",
|
||||
"europa": "⚽ Europa League",
|
||||
}
|
||||
lines = ["🏆 Доступные лиги для ставок:\n"]
|
||||
for alias, name in labels.items():
|
||||
lines.append(f" {name} → /matches {alias}")
|
||||
lines.append("\nПример: /matches epl")
|
||||
await message.reply("\n".join(lines), parse_mode=None)
|
||||
return
|
||||
|
||||
if sport_alias not in config.ODDS_SPORTS:
|
||||
if message.from_user:
|
||||
clear_user_sport_context(message.from_user.id)
|
||||
available = " / ".join(config.ODDS_SPORTS.keys())
|
||||
await message.reply(f"Неизвестная лига. Доступно: {available}", parse_mode=None)
|
||||
return
|
||||
if message.from_user:
|
||||
if sport_alias and sport_alias in config.ODDS_SPORTS:
|
||||
if sport_alias in config.ODDS_SPORTS:
|
||||
remember_user_sport_context(message.from_user.id, sport_alias)
|
||||
else:
|
||||
clear_user_sport_context(message.from_user.id)
|
||||
|
|
|
|||
Loading…
Reference in a new issue