I have a discord channel that is full of embedded messages. I would like have the bot display a random embedded message from this channel in to any other channel where the command is called, similar to the functionality shown below.
When I call this code while pointed at the embed channel it returns an error: "discord.errors.HTTPException: 400 Bad Request (error code: 50006): Cannot send an empty message"
I believe this is caused by the channel being totally embeds, but I am very stupid and open to being corrected. I have confirmed that the bot has full admin privileges and thus can see/write into any channel. I've also confirmed that the below code works on non-embeds in other channels.
Thank you in advance for any assistance you can provide.
@client.command()
async def bestpost(ctx):
channel = client.get_channel(channelID)
best_posts = []
async for message in channel.history(limit=500):
best_posts.append(message)
random_bestpost = random.choice(best_posts).content
await ctx.send(random_bestpost)
source https://stackoverflow.com/questions/73158661/id-like-my-discord-py-bot-to-display-a-random-embedded-message-from-a-single-ch
Comments
Post a Comment