N
N
Nikita Stupnikov2020-04-18 22:03:30
Python
Nikita Stupnikov, 2020-04-18 22:03:30

How to make the bot in a VK conversation respond with different messages?

How to make the bot reply with different messages to the same question?

Example:

- Who am I
- Cat astronaut

- Who am I
- Dog on the ground

Answer the question

In order to leave comments, you need to log in

1 answer(s)
N
Nikita Stupnikov, 2020-04-18
@JobJobBoy

Found a solution:
Create a list with different phrases/words:

spisok = ['Клубничный коктейль', 'Кот-космонавт'] (И так далее).

Use the 'RANDOM' library:
vk.method("messages.send", {"peer_id": id, "message": random.choice(spisok), "random_id": random.randint(1, 2147483647)})

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question