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

2024-06-28 01:53:41 发布

您现在位置:Python中文网/ 问答频道 /正文

我一直有这样的错误:discord.ext.commands.errors.MissingRequiredArgument:question是缺少的必需参数。 我看不出我的代码有任何问题,我正在使用“重写”,请看一下:

@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)

我已经做了完全相同的代码只是不同的响应,别名和异步定义,它的工作刚刚好,请帮助我不知道是什么错

代码here is the image的图片


Tags: to代码false错误inlineembedresponsesext
2条回答

我有同样的错误,所以我知道如何修复它

这就是您的代码应该是的内容

@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)

如果还有任何错误,请通过discord与我联系DrNano#9195

你也可以用这个

@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)

相关问题 更多 >