|
|
|
@ -43,6 +43,15 @@ async def get_channel_id(message: types.Message) -> None:
|
|
|
|
|
) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@dp.message_handler(commands=["m"]) |
|
|
|
|
@services.only_admins |
|
|
|
|
async def test_mes(message: types.Message) -> None: |
|
|
|
|
"""Для тестирования сообщений.""" |
|
|
|
|
q = services.get_text_from_command(message) |
|
|
|
|
|
|
|
|
|
await services.send_message_to_chat(message.date, 1, q, bot) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@dp.message_handler(commands=["q"]) |
|
|
|
|
@services.auth |
|
|
|
|
async def send_question(message: types.Message) -> None: |
|
|
|
@ -64,21 +73,10 @@ async def send_question(message: types.Message) -> None:
|
|
|
|
|
) |
|
|
|
|
return |
|
|
|
|
|
|
|
|
|
deletion_time = message.date + timedelta(minutes=settings.DELAY_TIME_Q) |
|
|
|
|
out_text = "*Внимание, вопрос!*\n\n" |
|
|
|
|
out_text += f"{message.text[3:]}\n\n" |
|
|
|
|
out_text += f"Будет удалено в *{deletion_time}*" |
|
|
|
|
|
|
|
|
|
result = await bot.send_message( |
|
|
|
|
chat_id=settings.CHAT_ID, |
|
|
|
|
text=out_text, |
|
|
|
|
disable_notification=True, |
|
|
|
|
parse_mode="Markdown", |
|
|
|
|
) |
|
|
|
|
text = "*Внимание, вопрос!*\n\n" |
|
|
|
|
text += question |
|
|
|
|
|
|
|
|
|
await services._clean_up( |
|
|
|
|
message_id=result.message_id, delay_min=settings.DELAY_TIME_Q, bot=bot |
|
|
|
|
) |
|
|
|
|
await services.send_message_to_chat(message.date, settings.DELAY_TIME_Q, text, bot) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@dp.message_handler(commands=["p"]) |
|
|
|
@ -89,21 +87,10 @@ async def send_post(message: types.Message) -> None:
|
|
|
|
|
Через бота можно отправить вопрос, который будет удален через |
|
|
|
|
DELAY_TIME_POST минут. |
|
|
|
|
""" |
|
|
|
|
deletion_time = message.date + timedelta(minutes=settings.DELAY_TIME_POST) |
|
|
|
|
post = services.get_text_from_command(message) |
|
|
|
|
|
|
|
|
|
out_text = f"{post}\n\n" |
|
|
|
|
out_text += f"Будет удалено в *{deletion_time}*" |
|
|
|
|
|
|
|
|
|
result = await bot.send_message( |
|
|
|
|
chat_id=settings.CHAT_ID, |
|
|
|
|
text=out_text, |
|
|
|
|
disable_notification=True, |
|
|
|
|
parse_mode="Markdown", |
|
|
|
|
) |
|
|
|
|
text = services.get_text_from_command(message) |
|
|
|
|
|
|
|
|
|
await services._clean_up( |
|
|
|
|
message_id=result.message_id, delay_min=settings.DELAY_TIME_POST, bot=bot |
|
|
|
|
await services.send_message_to_chat( |
|
|
|
|
message.date, settings.DELAY_TIME_POST, text, bot |
|
|
|
|
) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|