I
I
Ilya Bugaets2020-06-01 12:07:16
Python
Ilya Bugaets, 2020-06-01 12:07:16

Why is the bot not sending a message?

According to my idea, the bot should write the message "Hello, creator!" (when I write "Hello" in the chat)
But for some reason he does not do this, although my id is in the ilya variable

elif event.object.text == "Привет" :
                    ilya = event.object.from_id
                    #print(ilya)
                    if ilya == "270126576":
                        vk.method("messages.send", {"peer_id": event.object.peer_id, "message": 'Привет, создатель!', "random_id": 0})
                    else:
                        vk.method("messages.send", {"peer_id": event.object.peer_id, "message": 'Привет', "random_id": 0})

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
soremix, 2020-06-01
@ilyabugaets

Not an expert but

  1. Change random id
  2. Most likely you have a number in ilya, and you are comparing with a string. Do ilya = str(event.object.from_id) or ilya == 270126576

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question