Answer the question
In order to leave comments, you need to log in
How to handle vk_api.exceptions.ApiError: [15] Access denied: can't remove this user?
Because of what there is an error I perfectly understand. I had a couple of ideas on how to fix it, but none of them worked. (Error occurs when a user (admin) tries to kick a conversation admin)
if msg == "%кик":
x = session_api.messages.getById(message_ids=event.message_id)["items"][0]
from_id = x["from_id"]
if from_id in admin:
x = session_api.messages.getById(message_ids=event.message_id)
if x["items"][0].get("reply_message"):
reply = x["items"][0]["reply_message"]
send_message(peer_id=event.peer_id,message="❌ | @id" + str(reply["from_id"]) + "(Пользователь) был исключен из беседы.")
session_api.messages.removeChatUser(
chat_id=event.chat_id,
user_id=reply["from_id"])
Answer the question
In order to leave comments, you need to log in
check the id from the message replica for admin rights and if the id has these rights, display a message that the admin cannot exclude the admin / or at your discretion
https://vk.com/dev.php?method=messages.getConversa...
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question