Ошибка в библиотеке aiogram
Код:
def admin_moderate_command(command: str):
def decorator(func):
@admin_command(command)
async def handle(event: Message):
if not event.is_reply:
await event.respond('Пожалуйста, напишите эту команду в ответ на сообщение пользователя')
return
reply_to = await event.get_reply_message()
if reply_to.sender.bot:
await event.respond('Эту команду нельзя применять к ботам')
return
if await is_admin(event.chat.id, reply_to.sender.id):
await event.respond('Эту команду нельзя применять к админам')
return
result = await func(event.chat.id, reply_to.sender_id, get_mention(reply_to.sender))
await event.respond(result)
return handle
return decorator
Ошибка:
SyntaxError: 'await' outside async functio
Что делать?