Answer the question
In order to leave comments, you need to log in
How to implement a user kick from a conversation?
You need to kick a user from the conversation example:
/kick 123
123 is the user id.
The script is written on the vk_api library using LongPoll. My script:
import vk_api, json
from vk_api.longpoll import VkLongPoll, VkEventType
vk_session = vk_api.VkApi(token = '#')
longpoll = VkLongPoll(vk_session)
def sender(id, text):
vk_session.method('messages.send', {'chat_id' : id, 'message' : text, 'random_id' : 0})
for event in longpoll.listen():
if event.type == VkEventType.MESSAGE_NEW:
if event.to_me:
if event.from_chat:
msg = event.text.lower()
id = event.chat_id
if msg in ['привет', 'hi', 'ку']:
sender(id, f'Привет бро!')
Answer the question
In order to leave comments, you need to log in
An example for a group, but for a user it is easy to rewrite, almost nothing changes
How to make a kick command in VK api?
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question