[英]discord.py user embed title input only taking one word
我有這個命令叫做p!customembed [color] [title] [description]
。 這基本上就是它聽起來的樣子。 但是,有一個缺陷。 我希望我的機器人發送一個藍色嵌入,標題為“土豆很好”,描述為“測試”。 但是,標題是“土豆”,描述是“很好的測試”。 我正在考慮用/
之類的東西將 ctx 命令中的標題和描述分開,例如p!customembed [color] [title] / [description]
將兩者分開,但我不知道該怎么做。 任何人都可以幫忙嗎? 謝謝
@client.command()
async def customembed(ctx, color: discord.Colour, title, *, description):
embed = discord.Embed(title=title, description=description, color=color)
await ctx.send(embed=embed)
您可以通過將color, title, *, description
替換為content
然后拆分內容來完成此操作(您必須稍微重新制作命令)。
修改示例:
命令:
p!customembed /color/title/description
代碼:
@client.command()
async def customembed(ctx, content):
color, title, description = content.split('/', 3)
embed = discord.Embed(title=title, description=description, color=int(color))
await ctx.send(embed=embed)
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.