Я хочу сделать кик пользователя по упоминанию но у меня такая ошибка
DEBUG:vkbottle:Handling event (message_new) with message view
DEBUG:vkbottle:Casting state for peer_id 2000000001
DEBUG:vkbottle:Handler <FromFuncHandler user_joined blocking=True rules=(<PeerRule>, <OrRule>)> returned False
DEBUG:vkbottle:Handler <FromFuncHandler ping_handler blocking=True rules=(<VBMLRule>,)> returned False
DEBUG:vkbottle:Handler <FromFuncHandler wrapper blocking=True rules=(<PeerRule>, <VBMLRule>)> returned False
Вот код команды
def get_user_id(pattern: str) -> int:
if "[id" in pattern:
return int(pattern.split("|")[0].replace("[id", ""))
@bot.on.chat_message(text=['!fkick'])
@swear(VKError, exception_handler=exc_kick)
async def kick(message: Message):
members = await message.ctx_api.messages.get_conversation_members(peer_id=message.peer_id)
admins = [member.member_id for member in members.items if member.is_admin]
if message.from_id not in admins:
await message.answer('Вы не администратор беседы.')
else:
txt = message.reply_message.text
user_id = get_user_id(txt)
await message.ctx_api.messages.remove_chat_user(message.peer_id - 2000000000, user_id)
return "Пользователь успешно исключён"