Python 如何让用户选择自己的嵌入颜色
所以我有一个不和谐机器人,人们可以做r!说好让机器人说的东西作为一个嵌入,但它的工作没有任何帮助Python 如何让用户选择自己的嵌入颜色,python,discord,bots,Python,Discord,Bots,所以我有一个不和谐机器人,人们可以做r!说好让机器人说的东西作为一个嵌入,但它的工作没有任何帮助 @client.command(aliases=['say']) @commands.has_permissions(manage_messages=True) async def embed(ctx): questions = ["Which should be the tile of the embed?", "What shoul
@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."]
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 = answers2[2]
embed = discord.Embed(description=answers[1], title=answers[0], colour=int(embedcolor, 16))
await ctx.send(embed=embed)
我得到的错误是
discord.ext.commands.errors.CommandInvokeError:Command引发了一个异常:NameError:name'answers2'未定义正如前面提到的注释,您可能是想键入答案[2]而不是答案[2] 下次,将整个错误复制并粘贴到代码块中,如下所示:
[
error here
error here
]
看起来有个打字错误。我在你的代码中没有看到答案2的定义。你确定你不想写答案[2]而不是答案[2]?非常感谢你,我没有看到@GuillaumeLabs