我正在制作一个有各种命令的机器人。其中一个命令应该是嵌入。例如,您在何处说出命令、标题和描述。但是机器人只能用一个单词作为标题,一个单词作为描述。我需要帮助,我的代码在下面使用。(toob是前缀)
@client.command()
async def makeEmbed(ctx, title: str, description : str):
if not title:
await ctx.channel.send("One or more values are missing. Command should look like 'toob makeEmbed (title), (description)'")
elif not description:
await ctx.channel.send("One or more values are missing. Command should look like 'toob makeEmbed (title), (description)'")
embed = discord.Embed(title=title, description=description, color=0x72d345)
await ctx.send(embed=embed)
这里有一个想法:
援引→
toob make_embed Some Title | Some description with a loooot of words
缺点是您需要在消息中添加
|
, 下面是另一个使用wait_for()
的解决方案:援引↓
或者您可以按照ThRnk的建议进行操作
资料来源:
相关问题 更多 >
编程相关推荐