Compare commits
3 Commits
a44a592431
..
master
| Author | SHA1 | Date | |
|---|---|---|---|
| 2c7cfcb8df | |||
| f6ff247cd3 | |||
| ab9497c9a6 |
@@ -48,6 +48,22 @@ async def on_notification(msg: Message) -> None:
|
||||
)
|
||||
|
||||
|
||||
async def off_notification(msg: Message) -> None:
|
||||
"""
|
||||
Функция для отключения отправки уведомлений пользователя по времени
|
||||
|
||||
:param msg: Message - объект сообщения от пользователя
|
||||
|
||||
:return: None
|
||||
"""
|
||||
db = UseDB("users")
|
||||
db.del_document({"user_id": msg.from_user.id})
|
||||
await msg.answer(
|
||||
"Отлично, теперь уведомления не буду вам отправляться. "
|
||||
"Не забудьте в сентябре обратно их включить."
|
||||
)
|
||||
|
||||
|
||||
async def set_group(msg: Message) -> None:
|
||||
"""
|
||||
Функция для установки группы пользователя
|
||||
|
||||
@@ -35,6 +35,7 @@ def extract_week_data(soup: BeautifulSoup, shift: int) -> dict:
|
||||
current_day_of_week = datetime.datetime.now().weekday()
|
||||
if current_day_of_week + shift > 6:
|
||||
current_week_number += 1
|
||||
current_week_number += 1
|
||||
week_tab_id = "week_1_tab" if current_week_number % 2 else "week_2_tab"
|
||||
week_data: BeautifulSoup = soup.find('div', {"id": week_tab_id})
|
||||
day_name = (
|
||||
@@ -114,6 +115,7 @@ def get_data_in_database(group_id: int, shift: int = 0) -> dict:
|
||||
current_day_of_week = datetime.datetime.now().weekday()
|
||||
if current_day_of_week + shift > 6:
|
||||
current_week_number += 1
|
||||
current_week_number += 1
|
||||
week_tab_id = "week_1_tab" if current_week_number % 2 else "week_2_tab"
|
||||
day_name = (
|
||||
datetime.datetime.now() + datetime.timedelta(days=shift)
|
||||
|
||||
@@ -9,6 +9,7 @@ from aiogram.filters import Command
|
||||
from aiogram.types import Message
|
||||
|
||||
from additional_functions import (
|
||||
off_notification,
|
||||
on_notification,
|
||||
set_group,
|
||||
timetable_day,
|
||||
@@ -60,6 +61,11 @@ async def command_on_notification(msg: Message):
|
||||
)
|
||||
|
||||
|
||||
@dp.message(Command("off_notification"))
|
||||
async def command_off_notification(msg: Message):
|
||||
await off_notification(msg)
|
||||
|
||||
|
||||
@dp.message(F.text == "сегодня")
|
||||
@dp.message(Command("today"))
|
||||
async def command_today(msg: Message):
|
||||
|
||||
Reference in New Issue
Block a user