Answer the question
In order to leave comments, you need to log in
How to kick a user from a conversation with a python bot?
The VK documentation has a "messages.removeChatUser" method for kicking the user, but you need to know the conversation ID, how to find out for the bot?
if body.lower() == "кик":
vk.method("messages.removeChatUser", {"chat_id": chat_id, "user_id": user_id, "random_id": random.randint(1, 2147483647)})
Answer the question
In order to leave comments, you need to log in
Good afternoon!
In order to find the desired conversation - use "messages.getConversations". There will be a list of conversations with all the parameters from which you can get the desired ID using the name of the conversation
In order to delete a person on command - just add a similar
condition -something action
conversation id is the peer_id parameter and is calculated by the method 2000000000 + the sequence number of the conversation creation
My question is, what does random.randint do at the end of the request?
random is needed to generate a unique key, as in creating a message
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question