D
D
Dream Fox2020-08-01 15:49:54
Python
Dream Fox, 2020-08-01 15:49:54

How to reply to messages in a conversation and how to exclude users from a VK ID conversation?

Hello everyone, I'm new in the field of programming, so I decided to turn to Google first, which is why I didn't get an answer, but now I decided to turn to you.

I use my page, but the bot ignores messages both in the conversation and in the L / S. I tried several codes but it's 0, either an error, or there is no answer.

Actually, here is my shit code

import vk_api 
from datetime import datetime
from vk_api.longpoll import VkLongPoll, VkEventType 

token = "Токен" // токен пользователя
owner = "IdВладельцаКода"
vk_session = vk_api.VkApi(token=token)

session_api = vk_session.get_api()
longpoll = VkLongPoll(vk_session)

servertime = str(datetime.strftime(datetime.now(), "%H:%M"))

for event in longpoll.listen():
    if event.type == VkEventType.MESSAGE_NEW:
    	response = event.text.lower()
    	if response == "Привет":
            vk_session.method('messages.send', {'user_id': event.user_id, 'message': '1', 'random_id': 0})


I can't figure it out, please help.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
soremix, 2020-08-01
@DreamFox

vk_session.method

where did you get that design?
In the official github, everything is written
https://github.com/python273/vk_api/blob/master/ex...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question