D
D
dimaaksenov062018-08-13 15:01:03
Python
dimaaksenov06, 2018-08-13 15:01:03

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

1 answer(s)
E
Eugene, 2018-08-27
@ZeekSee

Where and after what do you need to insert this method?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question