A
A
apiwi2020-10-01 19:07:47
Python
apiwi, 2020-10-01 19:07:47

How to receive information about a new message in a conversation?

I want to make such a hat, so that if a conversation participant throws off an attachment in the form of a photo or story, the bot will delete this message and send a message to the conversation like: @id, Hey! What are you doing?
How can such a thing be done?
I understand what is needed: messages.getChat, messages.getByConversationMessageId, messages.deleteChatPhoto
But I don’t understand how to make the bot listen to the conversation, here is my sketch:

def start(self):
    while True:
      try:
        chat_id = vk.messages.searchConversations(q='Тест', count=1)['items'][0]['peer']['local_id']
        print(chat_id)
        message = 'Привет'
        vk.method("messages.send", {"peer_id": 2000000117, "message": message, "conversation_message_ids": 1})
      
      except Exception as ex:
        print("Error", ex)

Thank you for your help, no toxic please, I know there is freelancing, but I need something to push myself.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
alekssamos, 2020-10-02
@alekssamos

How to listen to longpoll and catch attachments from it?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question