Answer the question
In order to leave comments, you need to log in
Need help with a chat bot?
I have a code, for the second day I have been trying to fix errors in the code, but when I change something new errors appear, below I will give the last error and the last version of the code
the error itself:
vk.metod('messages.removeChatUser', {'peer_id' : event.object.peer_id, 'user_id' : obj.fwd_messages[0]['from_id']})
AttributeError: 'VkApi' object has no attribute 'metod'
import vk
from vk_api.bot_longpoll import VkBotLongPoll, VkBotEventType
import vk_api
import time
vk = vk_api.VkApi(token="токен группы")
vk.get_api()
longpoll = VkBotLongPoll(vk, "ид группы")
while True:
for event in longpoll.listen():
if event.type == VkBotEventType.MESSAGE_NEW:
if event.object.peer_id != event.object.from_id:
request = event.obj.text.lower()
if request == 'кик':
vk.metod('messages.removeChatUser', {'peer_id' : event.object.peer_id, 'user_id' : obj.fwd_messages[0]['from_id']})
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question