2022-02-16 18:13:44 +03:00
|
|
|
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 = "Ошибка обновления данных!"
|
2023-03-28 09:49:46 +03:00
|
|
|
if config.admin_users.split(',') is not None:
|
|
|
|
for user_id in config.admin_users.split(','):
|
|
|
|
if user_id in config.exclude:
|
2023-02-03 00:10:35 +03:00
|
|
|
continue
|
2022-02-16 18:13:44 +03:00
|
|
|
await dp.bot.send_message(user_id, message)
|
|
|
|
|
|
|
|
|
|
|
|
async def scheduler():
|
2023-03-28 09:49:46 +03:00
|
|
|
schedule.every(int(config.time)).seconds.do(announce)
|
2022-02-16 18:13:44 +03:00
|
|
|
|
|
|
|
while True:
|
|
|
|
await schedule.run_pending()
|
|
|
|
await asyncio.sleep(5)
|