python_bot_v2/handlers/coding.py

13 lines
538 B
Python
Raw Normal View History

2022-12-06 20:25:52 +10:00
from aiogram import types, Dispatcher
from create_bot import bot, dp
from sqdb import user, session
2022-12-06 20:56:30 +10:00
@dp.message_handler(commands=['alarming'])
2022-12-06 20:31:55 +10:00
async def notify_chats():
2022-12-06 20:25:52 +10:00
for chats in session.query(user.chat_id).distinct():
session.close()
2022-12-06 20:56:30 +10:00
await bot.send_message(chats,'<b>Ведутся пажилые работы,\n Ожидайте...</b>')
2022-12-06 20:57:57 +10:00
await bot.send_message(226765676, text= 'рассылка завершена')
2022-12-06 20:25:52 +10:00
def register_handlers_alarm(dp: Dispatcher):
dp.register_message_handler(notify_chats)