B
B
bybacapitan2022-04-18 01:02:53
Python
bybacapitan, 2022-04-18 01:02:53

How to make the bot respond with random phrases?

Hello, I need the bot to respond with a random phrase to a message.
Tell me how to do it.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
E
Elvis, 2022-04-18
@Dr_Elvis

random.choice

D
denislysenko, 2022-04-18
@denislysenko

You need to store these phrases
somewhere. For example, in an array
and thus mono output these random phrases

import random
 
my_list = ['hello', 'good', 'I dont know', 'Maybe']

result = random.choice(my_list)
print(result)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question