首页 > 解决方案 > 不和谐的建议命令

问题描述

我的代码:

@client.command()
async def suggest(ctx, suggestion):
    embed = discord.Embed(
        title = "New suggestion.",
        description = f"{suggestion}",
        color = 0,
        timestamp = ctx.message.created_at
    )
    embed.set_footer(text='Requested by {} | ID-{}' .format(ctx.message.author, ctx.message.author.id))

    await ctx.guild.owner.send(embed=embed)
    await ctx.send("Suggestion sent to server owner.")

这个命令的问题是机器人不会读取整个消息,它只读取它的第一个单词。例如,我发送此消息:=suggest this is suggestion并且机器人仅使用第一个单词向所有者发送嵌入,在这种情况下,它将仅发送嵌入this而不是整个句子。如果可能,怎么做?

标签: pythonpython-3.xdiscord.py

解决方案


您可以传递仅关键字参数

async def suggest(ctx, *, suggestion):

看看介绍


推荐阅读