I have this command called p!customembed [color] [title] [description]
. It's basically what it sounds like. However, there is one flaw. I want my bot to send a blue embed with the title being "potatoes are nice" and the description being "test". However, the title is "potatoes" and the description "are nice test". I was thinking of separating the title and description in the ctx command with something like /
, like p!customembed [color] [title] / [description]
to separate the two, but I have no clue how to do it. Can anyone help? Thx
@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)
You can do it with replacing color, title, *, description
with content
and then split the content up (you would have to remake your command a bit).
Revised example:
Command:
p!customembed /color/title/description
Code:
@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)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.