如何解决我如何将此命令嵌入到嵌入中?
我正在尝试发出命令。它的工作方式应该像它应该的那样,但是我想将命令嵌入到其中。一般来说,我对discord.py和编码尚不陌生。我知道如何制作普通的嵌入,但是当我使用此命令尝试嵌入时,会不断出现错误。有人可以帮忙吗? -谢谢:D
这是我的代码:
@client.command()
async def cid(ctx,*,content = None):
if content is None:
await ctx.send(f'No skin was given,try: lamo')
else:
try:
cosmetic = await BenBotAsync.get_cosmetic(
lang="en",searchLang="en",matchMethod="contains",name=content,backendType="AthenaCharacter"
)
await ctx.send(f'{cosmetic.name} is: {cosmetic.id}')
except BenBotAsync.exceptions.NotFound:
await ctx.send(f'Could not find a skin named: {content}')
解决方法
@client.command()
async def cid(ctx,*,content = None):
if content is None:
embed = discord.Embed(title="Error",description="No skin name was passed",colour=discord.Colour.red())
await ctx.send(embed=embed)
else:
try:
cosmetic = await BenBotAsync.get_cosmetic(
lang="en",searchLang="en",matchMethod="contains",name=content,backendType="AthenaCharacter"
)
e = discord.Embed(title="Skin Details",description=f"**{cosmetic.name}** is: **{cosmetic.id}**",colour=discord.Colour.green())
await ctx.send(embed=e)
except BenBotAsync.exceptions.NotFound:
e = discord.Embed(title="Error",description=f"Could not find a skin named: **{content}**",colour=discord.Colour.red())
await ctx.send(embed=e)
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。