Init commit

This commit is contained in:
Jemacivan
2022-02-16 17:13:44 +02:00
commit 8060b933a5
42 changed files with 1281 additions and 0 deletions

1
utils/__init__.py Normal file
View File

@@ -0,0 +1 @@
from .bot_commands import set_commands

27
utils/announcements.py Normal file
View File

@@ -0,0 +1,27 @@
import datetime
import asyncio
import aioschedule as schedule
from load import dp, config
from parser import docs_parse
async def announce():
date_now = datetime.datetime.today().weekday()
if (date_now == 5) or (date_now == 6): return
message = "Замены были обновлены, возможно появились изменения!)"
try:
docs_parse()
except Exception:
message = "Ошибка обновления данных!"
if config.admin_user is not None:
for user_id in config.admin_user:
await dp.bot.send_message(user_id, message)
async def scheduler():
schedule.every(int(config.anons('time'))).seconds.do(announce)
while True:
await schedule.run_pending()
await asyncio.sleep(5)

10
utils/bot_commands.py Normal file
View File

@@ -0,0 +1,10 @@
from aiogram import types
async def set_commands(dp):
await dp.bot.set_my_commands([
types.BotCommand("start", "получить список замен"),
types.BotCommand("help", "информация"),
types.BotCommand("link", "получить ссылку на файл"),
types.BotCommand("reload", "только для администрации"),
])