Answer the question
In order to leave comments, you need to log in
How to use messages.markAsRead?
I'm trying to get the bot to mark messages as read. I don't know how to insert the messages.markAsRead method, please help!
Code:
# -*- coding: utf-8 -*-
import vk_api, time, requests, bs4, random
vk = vk_api.VkApi(login='8...8', password='D....6' )
vk.auth()
values = {'out':0, 'count':100, 'time_offset':60}
vk.method('messages.getConversations', values)
def msg_send(user_id, s):
vk.method ('messages.send', {'user_id':user_id, 'message':s})
while True:
response = vk.method('messages.getConversations', values)
if response['items'] and response['items '][0]['last_message']['
if response['last_message']['text'].lower()=='hello' or response['last_message']['text'].lower()=='hello':
msg_send(response['conversation' ]['peer']['id'], 'Hi baby')
else:
msg_send(response['conversation']['peer']['id'], 'What?')
time.sleep(1)
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question