30 lines
870 B
Python
30 lines
870 B
Python
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:
|
|
if user_id in config.exclude_send_msg:
|
|
continue
|
|
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)
|