我做了一个建议命令,但如果用户不在他们的句子中添加引号,它只会选择他们输入的第一个单词例如:-suggest this is a test。 它只会选择“这个”对此有任何修复吗?命令代码行:@client.command()async def suggest(ctx, suggestion): channel = client.get_channel(754640430670413835) embed = discord.Embed(color=0xff0000) embed.add_field(name="SUGGESTION", value="{} suggested this: ** {} **".format(ctx.author.mention, suggestion), inline=False) await channel.send(embed=embed) await ctx.send("Thank you for your suggestion {}".format(ctx.author.mention))
1 回答
慕沐林林
TA贡献2016条经验 获得超9个赞
您可以要求图书馆将其余部分作为单个参数提供给您。我们通过使用仅关键字参数来做到这一点。在您的参数*之前添加一个。suggestion
@client.command()
async def suggest(ctx, *, suggestion):
channel = client.get_channel(754640430670413835)
embed = discord.Embed(color=0xff0000)
embed.add_field(name="SUGGESTION", value="{} suggested this: ** {} **".format(ctx.author.mention, suggestion), inline=False)
await channel.send(embed=embed)
await ctx.send("Thank you for your suggestion {}".format(ctx.author.mention))
添加回答
举报
0/150
提交
取消