Ask coding questions

← Back to all posts
Pulling randomly from a separate file for Discord.
SaladHat (1)

I need to pull from a text file (which I've done) but I need it to randomly pick from a list of defined quotes and send them randomly when i execute a command in discord. Thank you in advance.

Answered by Coder100 (18089) [earned 5 cycles]
View Answer
Coder100 (18089)

put it inside the on command so then it gets generated each time instead of only when the program starts

async def quote(ctx):
  random_quote = choice(quotes)
  await ctx.send(random_quote)
SaladHat (1)

Thank you. I didn't not think of that.