Answer the question
In order to leave comments, you need to log in
Why doesn't the bot write in the conversation?
import vk_api
import requests
import random
vk_session = vk_api.VkApi(token='token')
from vk_api.longpoll import VkLongPoll, VkEventType
longpoll = VkLongPoll(vk_session)
vk = vk_session.get_api()
for event in longpoll.listen():
if event.type == VkEventType.MESSAGE_NEW and event.to_me and event.text:
usergive=vk.users.get(user_ids=event.user_id)
idgive=vk.users.get(user_ids=event.user_id)
id=idgive[0]['id']
name=usergive[0]['first_name']
if event.text == "НАРУТООО":
if event.from_user:
print(vk.messages.send(
user_id=event.user_id,
message='САСКЕЕЕЕ',
random_id=0
))
elif event.from_chat:
vk.messages.send(
peer_id=2000000002,
message="САСКЕЕЕЕ",
random_id= 0
)
Answer the question
In order to leave comments, you need to log in
vk_api.longpoll will not process the message from the conversation, use vk_api.bot_longpoll
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question