How do I make a discord bot send a random message
How do I make my discord bot send a random message (A joke) out of a group of messages (I'll add multiple jokes to the group)? (I'm coding in python). My code below is what I already have
you would need something like this (i think):
randomJokelist=["Why did the chicken cross the road? To escape KFC!", "A PUNNY BOOK: “Spaghetti Sauces” by Alfred O.", "A PUNNY BOOK: “Buried Under Everest Snow” by Ava Lanche."] @client.event async def on_message(message): if message.author != client.user: if message.content.startswith('*joke'): numJoke = random.randint(0,len(randomJokelist)) await message.channel.send(randomJokelist[numJoke])
also, im pretty sure that you have to define the list where the jokes are being stored before you call them in the code.