Answer the question
In order to leave comments, you need to log in
Why doesn't the appeal from conversations to the community work?
I have this code:
import vk_api
import time
import sys
import requests
import json
import random as rnd
import vk
from vk_api.longpoll import VkLongPoll, VkEventType
token = 'token'
vk_session = vk_api.VkApi(token=token)
longpoll = VkLongPoll(vk_session)
vk = vk_session.get_api()
def sendmsg(confa, msg):
vk.messages.send(chat_id=confa, message=msg, random_id=0)
while True:
for event in longpoll.listen():
if event.type == VkEventType.MESSAGE_NEW and event.text:
lastmsg = event.text
print(lastmsg)
if (lastmsg=='/hellothere'):
print(event.user_id)
sendmsg(1, 'Test')
Answer the question
In order to leave comments, you need to log in
The solution was found, for this I just wrote my methods through the Requests library.
Off . The documentation says that in order to receive any messages from conversations (by default, only those in which there is an appeal to the bot are taken), you need to give the bot the rights "Access to all correspondence" or "Administrator" in the bot settings and make sure that the API version is not lower than 5.80
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question