我假设它在某个地方出了问题,并且on_command_error正在捕获它,但没有给我任何反馈...
我很确定我做的正确,因为我是直接从另一个机器人复制来的,但是很明显我丢失了一些东西。我觉得我只是缺少一些小细节。
@client.command(name='info')
@commands.has_any_role("Community Manager")
async def info(self, ctx):
"""Display bot info, e.g. library versions."""
embed = discord.Embed()
embed.description = ctx.bot.description
ainfo = await ctx.bot.application_info()
owner = str(ainfo.owner)
embed.add_field(name="Owner", value=owner)
embed.add_field(name="# of commands", value=len(ctx.bot.commands))
num_guilds = len(ctx.bot.guilds)
num_users = sum(not member.bot for member in ctx.bot.get_all_members())
embed.add_field(name="Serving", value=f"{num_users} people in {num_guilds} guilds")
embed.add_field(name="Python", value="{0}.{1}.{2}".format(*sys.version_info))
embed.add_field(name="discord.py", value=discord.__version__)
await ctx.send(embed=embed)