so i made this code where users can chose their own embed color, but if they out in a wrong embed, it will mess up the whole thing and they need to redo, is there anyway to make it so if they don't respond or put in a incorrect hex code it will automatically go to the hex color FF00EC.
@client.command(aliases=['say']) @commands.has_permissions(manage_messages=True) async def embed(ctx): questions = ["Which should be the tile of the embed?", "What should be the description?", "What is the color of the embed? This should be a hex color. Note, Must put a `Correct` Hex color or you will need to redo this also leave out the #."] answers = [] def check(m): return m.author == ctx.author and m.channel == ctx.channel for i in questions: await ctx.send(i) try: msg = await client.wait_for('message', timeout=30, check=check) except asyncio.TimeoutError: await ctx.send('You did not answer in time. Please do it under 30 seconds next time.') return else: answers.append(msg.content) embedcolor = answers[2] embed = discord.Embed(description=answers[1], title=answers[0], colour=int(embedcolor, 16)) await ctx.send(embed=embed)``` so here is my code
https://stackoverflow.com/questions/67352155/embeds-for-discord-python-bots May 02, 2021 at 09:04AM
没有评论:
发表评论