discord.py重写中的错误:discord.ext.commands.errors.MissingRequiredArgument:问题是缺少的必需参数

时间:2020-04-02 06:58:03

标签: python bots discord discord.py-rewrite

我一直遇到此错误:discord.ext.commands.errors.MissingRequiredArgument:问题是缺少的必需参数。 我的代码完全看不到任何问题,我正在使用重写,请看一下:

@client.command(aliases =['insultme', 'plzinsult'])
async def _insultme(ctx, *, question):
    responses = ['You make it impossible to underestimate you',
                 'I may love to shop but i, myself, will never buy your bullshit.',]
    embed = discord.Embed(title='Question:', description=question, color=0x2332e4, inline=False)
    embed.add_field(name='Answer:', value=random.choice(responses), inline=False)
    await ctx.send(embed=embed)

我已经执行了完全相同的代码,只是响应,别名和异步def不同,它的工作效果还不错,请帮助我不知道怎么了。

代码here is the image

的图片

2 个答案:

答案 0 :(得分:0)

我有同样的错误,所以我知道如何解决!

这就是您的代码应该

@bot.command(aliases=['insultme', 'plzinsult'])
async def insultme(ctx, *, question):
    responses = ['You make it impossible to underestimate you', 'I may love to shop but i,myself, will never buy your bullshit.',]
    embed = discord.Embed(title='Question:', description=question, color=0x2332e4, inline=False)
    embed.add_field(name='Answer:', value=random.choice(responses), inline=False)
    await ctx.send(embed=embed)

如果还有其他错误,请通过不和谐与我联系! DrNano#9195

答案 1 :(得分:0)

您也可以使用它!

@client.command(aliases=['insult me', 'plzinsult'])
async def insultme(ctx, *, question):
    responses = ['You make it impossible to underestimate you', 'I may love to shop but i,myself, will never buy your bullshit.',]
    embed = discord.Embed(title='Question:', description=random.choice(responses), color=0x2332e4, inline=False)
    await ctx.send(embed=embed)