How can I make a variable list of embeds for a discord bot?

Viewed 192

It sounds like a basic question but I'm still just a newbie and I'm just trying to make a fun discord bot for my friends and I've been stuck trying to make this function where I have a list of embeds and a random.choice function chooses one and sends it. I've tried changing some of the phrasing and the image links. Any idea what I could do differently or change about my approach to this problem?

1 Answers

while random.choice DOES select one item from list but it DOES NOT delete the other elements from the list, you didn't assign a variable to random.choice() which means, your random.choice(horoscopes) DOES NOT hold any significance in the command. (or in other words, the line becomes useless)

horoscopes is still a list, and the embed kwarg in ctx.send won't just take it.

what you can do is re-initialize the horoscopes variable with random.choice(horoscopes) assigned to it and then pass it to embed kwarg

and it's really inconvenient when the code is on an image, from next post the code and not the image along with the traceback

Also, don't forget to regenerate your token.

horoscopes = [embed1, embed2, embed3, embed4, #.....more embed objects]
horoscopes = random.choice(horoscopes)
await ctx.send(embed=horoscopes)
Related