Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| e65f5e16d0 | |||
| 5f014a4b8d |
@@ -1,9 +1,11 @@
|
||||
import re
|
||||
import datetime
|
||||
from aiogram.types import Message, ReplyKeyboardMarkup, KeyboardButton
|
||||
import re
|
||||
|
||||
from aiogram import Bot
|
||||
from get import get_timetable_for_day, fetch_timetable_data
|
||||
from aiogram.types import KeyboardButton, Message, ReplyKeyboardMarkup
|
||||
|
||||
from DB import UseDB
|
||||
from get import fetch_timetable_data, get_timetable_for_day
|
||||
|
||||
|
||||
def get_group_id(user_id):
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import datetime
|
||||
|
||||
import requests
|
||||
from bs4 import BeautifulSoup
|
||||
import datetime
|
||||
|
||||
from DB import UseDB
|
||||
|
||||
|
||||
@@ -1,16 +1,20 @@
|
||||
import asyncio
|
||||
from datetime import datetime, timedelta
|
||||
|
||||
from aiogram import Dispatcher, Bot, F
|
||||
import environs
|
||||
from aiogram import Bot, Dispatcher, F
|
||||
from aiogram.client.default import DefaultBotProperties
|
||||
from aiogram.enums import ParseMode
|
||||
from aiogram.filters import Command
|
||||
from aiogram.types import Message
|
||||
import environs
|
||||
|
||||
from additional_functions import (
|
||||
on_notification,
|
||||
set_group,
|
||||
timetable_day,
|
||||
timetable_for_day,
|
||||
)
|
||||
from DB import UseDB
|
||||
from additional_functions import (on_notification, set_group, timetable_for_day,
|
||||
timetable_day)
|
||||
from use_database import detect_group_to_update
|
||||
|
||||
env = environs.Env()
|
||||
@@ -20,7 +24,7 @@ dp = Dispatcher()
|
||||
|
||||
|
||||
@dp.message(Command("start"))
|
||||
async def start_handler(msg: Message):
|
||||
async def command_start(msg: Message):
|
||||
await msg.answer(
|
||||
"Приветствую!\nЭтот бот предназначен для просмотра расписания занятий "
|
||||
"для любой группы СибГУ, включая сегодня, завтра и послезавтра.\n"
|
||||
@@ -35,7 +39,7 @@ async def start_handler(msg: Message):
|
||||
|
||||
|
||||
@dp.message(Command("set_group"))
|
||||
async def start_handler(msg: Message):
|
||||
async def command_set_group(msg: Message):
|
||||
if len(msg.text.split()) == 2:
|
||||
await set_group(msg)
|
||||
else:
|
||||
@@ -46,7 +50,7 @@ async def start_handler(msg: Message):
|
||||
|
||||
|
||||
@dp.message(Command("on_notification"))
|
||||
async def start_handler(msg: Message):
|
||||
async def command_on_notification(msg: Message):
|
||||
if len(msg.text.split()) == 2:
|
||||
await on_notification(msg)
|
||||
else:
|
||||
@@ -58,19 +62,19 @@ async def start_handler(msg: Message):
|
||||
|
||||
@dp.message(F.text == "сегодня")
|
||||
@dp.message(Command("today"))
|
||||
async def start_handler(msg: Message):
|
||||
async def command_today(msg: Message):
|
||||
await timetable_for_day(msg)
|
||||
|
||||
|
||||
@dp.message(F.text == "завтра")
|
||||
@dp.message(Command("tomorrow"))
|
||||
async def start_handler(msg: Message):
|
||||
async def command_tomorrow(msg: Message):
|
||||
await timetable_for_day(msg, 1)
|
||||
|
||||
|
||||
@dp.message(F.text == "послезавтра")
|
||||
@dp.message(Command("the_day_after_tomorrow"))
|
||||
async def start_handler(msg: Message):
|
||||
async def command_the_day_after_tomorrow(msg: Message):
|
||||
await timetable_for_day(msg, 2)
|
||||
|
||||
|
||||
@@ -107,5 +111,6 @@ async def main() -> None:
|
||||
_ = asyncio.create_task(update_data())
|
||||
await dp.start_polling(bot)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
asyncio.run(main())
|
||||
|
||||
Generated
+27
-1
@@ -831,6 +831,32 @@ urllib3 = ">=1.21.1,<3"
|
||||
socks = ["PySocks (>=1.5.6,!=1.5.7)"]
|
||||
use-chardet-on-py3 = ["chardet (>=3.0.2,<6)"]
|
||||
|
||||
[[package]]
|
||||
name = "ruff"
|
||||
version = "0.4.8"
|
||||
description = "An extremely fast Python linter and code formatter, written in Rust."
|
||||
optional = false
|
||||
python-versions = ">=3.7"
|
||||
files = [
|
||||
{file = "ruff-0.4.8-py3-none-macosx_10_12_x86_64.whl", hash = "sha256:7663a6d78f6adb0eab270fa9cf1ff2d28618ca3a652b60f2a234d92b9ec89066"},
|
||||
{file = "ruff-0.4.8-py3-none-macosx_11_0_arm64.whl", hash = "sha256:eeceb78da8afb6de0ddada93112869852d04f1cd0f6b80fe464fd4e35c330913"},
|
||||
{file = "ruff-0.4.8-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:aad360893e92486662ef3be0a339c5ca3c1b109e0134fcd37d534d4be9fb8de3"},
|
||||
{file = "ruff-0.4.8-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:284c2e3f3396fb05f5f803c9fffb53ebbe09a3ebe7dda2929ed8d73ded736deb"},
|
||||
{file = "ruff-0.4.8-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:a7354f921e3fbe04d2a62d46707e569f9315e1a613307f7311a935743c51a764"},
|
||||
{file = "ruff-0.4.8-py3-none-manylinux_2_17_ppc64.manylinux2014_ppc64.whl", hash = "sha256:72584676164e15a68a15778fd1b17c28a519e7a0622161eb2debdcdabdc71883"},
|
||||
{file = "ruff-0.4.8-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:9678d5c9b43315f323af2233a04d747409d1e3aa6789620083a82d1066a35199"},
|
||||
{file = "ruff-0.4.8-py3-none-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:704977a658131651a22b5ebeb28b717ef42ac6ee3b11e91dc87b633b5d83142b"},
|
||||
{file = "ruff-0.4.8-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:d05f8d6f0c3cce5026cecd83b7a143dcad503045857bc49662f736437380ad45"},
|
||||
{file = "ruff-0.4.8-py3-none-musllinux_1_2_aarch64.whl", hash = "sha256:6ea874950daca5697309d976c9afba830d3bf0ed66887481d6bca1673fc5b66a"},
|
||||
{file = "ruff-0.4.8-py3-none-musllinux_1_2_armv7l.whl", hash = "sha256:fc95aac2943ddf360376be9aa3107c8cf9640083940a8c5bd824be692d2216dc"},
|
||||
{file = "ruff-0.4.8-py3-none-musllinux_1_2_i686.whl", hash = "sha256:384154a1c3f4bf537bac69f33720957ee49ac8d484bfc91720cc94172026ceed"},
|
||||
{file = "ruff-0.4.8-py3-none-musllinux_1_2_x86_64.whl", hash = "sha256:e9d5ce97cacc99878aa0d084c626a15cd21e6b3d53fd6f9112b7fc485918e1fa"},
|
||||
{file = "ruff-0.4.8-py3-none-win32.whl", hash = "sha256:6d795d7639212c2dfd01991259460101c22aabf420d9b943f153ab9d9706e6a9"},
|
||||
{file = "ruff-0.4.8-py3-none-win_amd64.whl", hash = "sha256:e14a3a095d07560a9d6769a72f781d73259655919d9b396c650fc98a8157555d"},
|
||||
{file = "ruff-0.4.8-py3-none-win_arm64.whl", hash = "sha256:14019a06dbe29b608f6b7cbcec300e3170a8d86efaddb7b23405cb7f7dcaf780"},
|
||||
{file = "ruff-0.4.8.tar.gz", hash = "sha256:16d717b1d57b2e2fd68bd0bf80fb43931b79d05a7131aa477d66fc40fbd86268"},
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "soupsieve"
|
||||
version = "2.5"
|
||||
@@ -976,4 +1002,4 @@ multidict = ">=4.0"
|
||||
[metadata]
|
||||
lock-version = "2.0"
|
||||
python-versions = "^3.11"
|
||||
content-hash = "d5c0b13d3c9497feef75f74fc3d838fe2dfe1c241e1fd9fcb155b13039b8c861"
|
||||
content-hash = "2e86a3f4ac5a604b1b11b405e86729d03e00280df4cfb4c132a0021ade6248ea"
|
||||
|
||||
@@ -13,8 +13,26 @@ requests = "^2.31.0"
|
||||
bs4 = "^0.0.2"
|
||||
pymongo = "^4.6.1"
|
||||
environs = "^11.0.0"
|
||||
ruff = "^0.4.8"
|
||||
|
||||
|
||||
[build-system]
|
||||
requires = ["poetry-core"]
|
||||
build-backend = "poetry.core.masonry.api"
|
||||
|
||||
[tool.ruff]
|
||||
exclude = [
|
||||
".git",
|
||||
".ruff_cache",
|
||||
".venv",
|
||||
"venv",
|
||||
"mongodb",
|
||||
"data",
|
||||
]
|
||||
line-length = 92
|
||||
|
||||
[tool.ruff.lint]
|
||||
select = ["E", "F", "UP", "I"]
|
||||
|
||||
[tool.ruff.format]
|
||||
skip-magic-trailing-comma = true
|
||||
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
from bs4 import BeautifulSoup
|
||||
|
||||
from get import fetch_timetable_data, parse_day_data
|
||||
from DB import UseDB
|
||||
from get import fetch_timetable_data, parse_day_data
|
||||
|
||||
|
||||
def update_database(group_id: int) -> None:
|
||||
|
||||
Reference in New Issue
Block a user