forked from Pavel_Durov/python_bot
29 lines
979 B
Python
29 lines
979 B
Python
|
|
from create_bot import dp, bot
|
|
from aiogram import types, Dispatcher
|
|
from sqdb import user, session
|
|
|
|
|
|
|
|
@dp.message_handler(commands=['sendall'])
|
|
async def sendall(message: types.Message):
|
|
print('команда прошла')
|
|
if message.chat.type == 'private':
|
|
if message.from_user.id == 226765676:
|
|
text = message.text[9:]
|
|
try:
|
|
chats_id = -1001355646177
|
|
|
|
try:
|
|
await bot.send_message(chats_id, text)
|
|
except:
|
|
print('вероятно бота нет в чате')
|
|
await bot.send_message(message.from_user.id, 'Сообщение успешно отправлено во все чаты')
|
|
except:
|
|
session.rollback()
|
|
print('eror sendall')
|
|
finally: session.close_all()
|
|
|
|
|
|
# def register_handlers_test(dp: Dispatcher):
|
|
# dp.register_message_handler(send_welcome) |