Answer the question
In order to leave comments, you need to log in
Messages.getConversations gives only conversations created by the community and does not see other conversations, how to fix it?
I need to get the count of all conversations in which the bot is added, messages.getConversations was advised, but it only returns conversations that are in the community. Maybe some kind of key needs to be registered? Please help
A piece of code:
if event_chat.type == VkBotEventType.WALL_POST_NEW:
besedi = (getting_api.messages.getConversations())['items']
for i in range(len(besedi)):
print(i)
post_otpravka = ((besedi[i]['conversation'])['peer'])['local_id']
id_ = event_chat.object['id']
owner_id_ = event_chat.group_id
wall_post = f'wall-{owner_id_}_{id_}'
authorize.method('messages.send', {'peer_id': 2000000000 + post_otpravka, 'message': 'Новый пост в группе', 'attachment': wall_post,'random_id': get_random_id()})
Answer the question
In order to leave comments, you need to log in
Calling `Messages.getConversations` does not get conversations.
Catch the conversation id's in the event handler. In the notification of a new message, the VC passes the message object with the `peer_id` property (this is the id of the conversation) - keep it with you and use it in your logic.
If necessary, for all conversations - you can alternately enumerate all peer_id, starting from 2000000000 to the first error about lack of access.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question