F
F
feven2019-10-16 16:15:38
Python
feven, 2019-10-16 16:15:38

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'

the code itself:
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

1 answer(s)
E
Erik Mikoyan, 2019-10-20
@erik_mikoyan

Because you have a method, not a method

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question