【发布时间】:2021-07-24 16:15:44
【问题描述】:
所以我有一个不和谐的机器人,人们可以做 r!say 来很好地让机器人说东西作为嵌入,但它没有任何帮助?
@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:命令引发异常:NameError:未定义名称'answers2'
【问题讨论】:
-
好像有错字。我在您的代码中的任何地方都没有看到 answers2 定义。您确定不想写 answers[2] 而不是 answers2[2] 吗?
-
非常感谢我没有看到@GuillaumeLabs