feat: 01 schedule

This commit is contained in:
2026-01-28 13:41:59 +03:00
parent 95cd4b5fb1
commit a16a979c63
2 changed files with 93 additions and 7 deletions

View File

@ -98,7 +98,7 @@ def register_command_handlers(bot: telebot.TeleBot) -> None:
@bot.message_handler(commands=['month'], chat_types=['group', 'supergroup'])
def handle_month(message: telebot.types.Message) -> None:
"""Handle /month command - show birthdays for next 30 days."""
"""Handle /month command - show birthdays for next 31 days."""
chat_id = message.chat.id
db = get_db_session()
@ -109,16 +109,16 @@ def register_command_handlers(bot: telebot.TeleBot) -> None:
bot.reply_to(message, "Мне нужны права администратора для выполнения этой команды.")
return
# Get birthdays for next 30 days
# Get birthdays for next 31 days
today = datetime.now().date()
birthdays = get_birthdays_in_range(db, chat_id, today, days=30)
birthdays = get_birthdays_in_range(db, chat_id, today, days=31)
if not birthdays:
bot.reply_to(message, "На ближайшие 30 дней дней рождений не запланировано.")
bot.reply_to(message, "На ближайшие 31 день дней рождений не запланировано.")
return
# Format message
message_text = "🎂 Дни рождения на ближайшие 30 дней:\n\n"
message_text = "🎂 Дни рождения на ближайшие 31 день:\n\n"
for date_str, names in sorted(birthdays.items()):
names_list = ", ".join(names)
message_text += f"{date_str}: {names_list}\n"
@ -134,7 +134,7 @@ def register_command_handlers(bot: telebot.TeleBot) -> None:
"📚 Команды бота:\n\n"
"/stats - Показать статистику: сколько человек поделились днем рождения\n"
"/week - Показать дни рождения на ближайшие 7 дней\n"
"/month - Показать дни рождения на ближайшие 30 дней\n"
"/month - Показать дни рождения на ближайшие 31 день\n"
"/help - Показать это сообщение\n\n"
"Чтобы поделиться своим днем рождения, напиши боту в личку /start\n\n"
"from olly & cursor with <3"