对此有解决方案吗?
async def cosmetic(ctx, name : int):
response = requests.get("https://fortnite-api.com/v2/cosmetics/br")
embed=discord.Embed(
title=f"{name}", color=0x9c3030
)
embed.add_field(f'Rarity: {BrCosmeticRarity}')
await ctx.send(embed=embed)
您通过显式地将name
转换为int
async def cosmetic(ctx, name : int):
name
不应该是int类型,因为它可能是一个字符串。要解决您的问题,请在函数声明中为name
设置正确的类型
async def cosmetic(ctx, name : str):
async def cosmetic(ctx, name : str):
response = requests.get("https://fortnite-api.com/v2/cosmetics/br")
embed=discord.Embed(
title=f"{name}", color=0x9c3030
)
embed.add_field(f'Rarity: {BrCosmeticRarity}')
await ctx.send(embed=embed)