@bot.on.chat_message(lower=True, text=['кик', 'бан', 'ban', 'kick'])
@swear(VKError, exception_handler=exc_kick)
async def kick(message: Message):
members = await message.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('ты не одмен беседы.')
else:
txt = message.reply_message.text
await bot.api.messages.remove_chat_user(message.peer_id - 2000000000, message.reply_message.from_id)
return "Пользователь успешно исключён"
[id12345|Вася Пупкин]
def get_user_id(pattern: str) -> int:
if "[id" in pattern:
return int(pattern.split("|")[0].replace("[id", ""))
def get_user_id(pattern: str) -> int:
if "vk.com/" in pattern:
domen = pattern.split("/")[-1]
return vk.method("users.get", {"user_ids": domen})[0]["id"]