|
|
|
@ -87,7 +87,7 @@ async def clean_up(message_id: int, delay_min: int):
|
|
|
|
|
@dp.message_handler(commands=["start", "help"]) |
|
|
|
|
@auth |
|
|
|
|
async def send_welcome(message: types.Message): |
|
|
|
|
|
|
|
|
|
"""Справка по командам.""" |
|
|
|
|
await message.reply( |
|
|
|
|
"Бот для взаимодействия с группой\n\n" "/q - для отправки вопроса\n", |
|
|
|
|
reply=False, |
|
|
|
@ -95,8 +95,9 @@ async def send_welcome(message: types.Message):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@dp.message_handler(commands=["channel_id"]) |
|
|
|
|
@only_admins |
|
|
|
|
async def get_channel_id(message: types.Message) -> None: |
|
|
|
|
"""Возвращает id канала по его имени""" |
|
|
|
|
"""Возвращает id канала по его имени.""" |
|
|
|
|
if message["from"]["id"] not in ADMINS: |
|
|
|
|
return |
|
|
|
|
|
|
|
|
@ -115,7 +116,7 @@ async def get_channel_id(message: types.Message) -> None:
|
|
|
|
|
|
|
|
|
|
@dp.message_handler(commands=["mes"]) |
|
|
|
|
@auth |
|
|
|
|
async def send_to_chanel(message: types.Message): |
|
|
|
|
async def send_to_chanel(message: types.Message) -> None: |
|
|
|
|
|
|
|
|
|
deletion_time = message.date + timedelta(minutes=DELAY_TIME) |
|
|
|
|
out_text = f"{message.text[5:]} \n\nБудет удалено в *{deletion_time}*" |
|
|
|
@ -131,7 +132,7 @@ async def send_to_chanel(message: types.Message):
|
|
|
|
|
|
|
|
|
|
@dp.message_handler(commands=["q"]) |
|
|
|
|
@auth |
|
|
|
|
async def send_question(message: types.Message): |
|
|
|
|
async def send_question(message: types.Message) -> None: |
|
|
|
|
"""Отправить вопрос через бота. |
|
|
|
|
|
|
|
|
|
Через бота можно отправить вопрос, который будет удален через |
|
|
|
@ -142,8 +143,9 @@ async def send_question(message: types.Message):
|
|
|
|
|
await message.reply( |
|
|
|
|
"Пишешь пусто - делаешь грустно (мне)" |
|
|
|
|
"\nПосле /q надо написать вопрос, вот так:" |
|
|
|
|
"\n\n/q как доехать до Баррикадной?", |
|
|
|
|
"\n\n`/q как доехать до Баррикадной?`", |
|
|
|
|
reply=False, |
|
|
|
|
parse_mode="Markdown", |
|
|
|
|
) |
|
|
|
|
return |
|
|
|
|
|
|
|
|
@ -238,7 +240,7 @@ async def stop_and_panic(message: types.Message) -> None:
|
|
|
|
|
""" |
|
|
|
|
u_id = message["from"]["id"] |
|
|
|
|
finded_user: Allowed_user = ( |
|
|
|
|
session.query(Allowed_user).filter(Allowed_user.user_id == u_id).first() |
|
|
|
|
session.query(Allowed_user).filter(Allowed_user.user_id == u_id).one_or_none() |
|
|
|
|
) |
|
|
|
|
await bot.kick_chat_member( |
|
|
|
|
chat_id=CHAT_ID, user_id=finded_user.user_id, revoke_messages=True |
|
|
|
@ -253,7 +255,7 @@ async def stop_and_panic(message: types.Message) -> None:
|
|
|
|
|
|
|
|
|
|
@dp.message_handler(commands=["wlc"]) |
|
|
|
|
@auth |
|
|
|
|
async def wlc(message: types.Message): |
|
|
|
|
async def wlc(message: types.Message) -> None: |
|
|
|
|
with open("welcome_msg.txt", "r") as f: |
|
|
|
|
msg = f.read() |
|
|
|
|
await message.reply( |
|
|
|
|