Discord.py 应用程序没有响应

问题描述 投票:0回答:1

我尝试在discord.py重写上使用斜杠命令进行嵌入,它只是简单地说应用程序没有响应

我尝试使用 EMBED 输出创建斜杠命令。我希望它会像往常一样发送嵌入内容,但是。说应用程序没有响应

@bot.tree.command(name="avatar", description="avatar show lol")
async def avatar(ctx:discord.Interaction, member:discord.Member):
    embed = discord.Embed(title="Avatar", description=f"{member.mention}'s avatar!", color=discord.Color.random())
    embed.set_thumbnail(url=member.avatar)
    embed.set_footer(text=f"Requested by {ctx.message.author.name}", icon_url=ctx.message.author.avatar)
    await ctx.response.send_message(embeds=[embed])

@bot.event
async def on_ready():
    try:
        synced = await bot.tree.sync()
        print(f"Synced {len(synced)} commands")
    except Exception as e:
        print(e)
    await bot.change_presence(activity=discord.Activity(type=discord.ActivityType.watching, name ="what"))
    print(f"Bot account: {bot.user}")
    print(f"{discord.__version__} is lib ver")

asyncio.run(main())
python discord discord.py
1个回答
0
投票

尝试删除嵌入周围的 [],这使得嵌入作为列表传递。

await ctx.response.send_message(embeds=embed)

© www.soinside.com 2019 - 2024. All rights reserved.