replace-bot/handlers/private/admin.py
2022-02-16 17:13:44 +02:00

24 lines
609 B
Python
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import logging
from aiogram import types
from load import dp, bot
from parser import docs_parse
@dp.message_handler(admin=True, commands=['reload'])
async def refresh(message: types.Message):
m = await bot.send_message(
message.chat.id,
"Идёт обновление информации..."
)
try:
docs_parse()
await m.edit_text(
"Информация о заменах была обновлена!"
)
except Exception as e:
logging.error(e)
await m.edit_text(
"Произойшла ошибка!"
)