from vk_api.bot_longpoll import VkBotLongPoll, VkBotEventType
import vk_api
vk_session = vk_api.VkApi(token='MyToken')
vk = vk_session.get_api()
longpoll = VkBotLongPoll(vk_session, group)
def kick_all(user_id):
try:
result = cursor.execute(f'SELECT * FROM `chats`')
row = cursor.fetchall()
for chat_s in row:
vk.messages.removeChatUser(chat_id=chat_s['chat_id'], member_id=user_id)
return f"Пользователь был кикнут во всех беседах."
except vk_api.exceptions.ApiError:
pass