Discord.py 命令不给出输出

Discord.py 命令不给出输出,discord.py,Discord.py,因此,我正在生成一个用户信息命令,当我运行该命令时,它不工作,并且不会给出错误 这是我的密码: @commands.command() 异步定义信息(self,ctx,*,成员:discord.member): embed=discord.embed(color=0xFFFFF0,title=f“{ctx.author.name}的信息”,description=“显示用户信息”) embed.set_缩略图(url=f“{ctx.author.avatar_url}”) embed.add_字

因此,我正在生成一个用户信息命令,当我运行该命令时,它不工作,并且不会给出错误

这是我的密码:

@commands.command()
异步定义信息(self,ctx,*,成员:discord.member):
embed=discord.embed(color=0xFFFFF0,title=f“{ctx.author.name}的信息”,description=“显示用户信息”)
embed.set_缩略图(url=f“{ctx.author.avatar_url}”)
embed.add_字段(name=“User ID:”,value=f“{ctx.author.ID}”,inline=True)
embed.add_字段(name=“Color:,value=f”{ctx.author.top_role.notice}\n[{ctx.author.top_role.Color}]))
embed.add_字段(name=“Join Date:”,value=f“{ctx.author.Join_at}”)
embed.timestamp=datetime.datetime.utcnow()
embed.set_footer(text=f“请求者:{ctx.author}”,icon_url=ctx.author.avatar_url)
等待ctx.send(嵌入=嵌入)

你基本上把
ctx.author
,作者是你,如果你这样做了,你就不能显示其他用户的信息。如果要显示其他用户的信息,应使用
if
语句

最后一件事是加入日期。它将发送这个奇怪的时间
04:22:23.699000
。因此,您应该将时间转换为
strftime

更新代码:

@commands.command()
async def info(self,ctx,*,member:discord.member=None):#将成员更改为None,以便在用户未提及该成员时工作
if member==None:#表明如果用法没有提到成员(if语句)
成员=ctx.author
#将ctx.author的所有嵌入更改为成员
embed=discord.embed(title=f“{member.name}的信息”,description=“显示用户信息”,color=0xFFFFF0)
embed.set_缩略图(url=f“{member.avatar_url}”)
embed.add_字段(name=“User ID:”,value=f“{member.ID}”,inline=True)
embed.add_字段(name=“Color:,value=f”{member.top_role.notice}\n[{member.top_role.Color}]))
embed.add_字段(name=“Join Date:”,value=member.joined_在.strftime(“%B%d%Y\n%H:%M:%S%p”))#让时间看起来很好
embed.timestamp=datetime.datetime.utcnow()
embed.set_footer(text=f“请求者:{ctx.author}”,icon_url=ctx.author.avatar_url)#将成员更改为ctx.author
等待ctx.send(嵌入=嵌入)

稍后谢谢:D

您确定函数调用正确吗?我没发现你的代码有什么问题你有没有安排课程?您是否从discord.ext导入命令导入了
?关于你的结构的更多信息/代码会更好。是的,我已经建立了一个类。你添加了Cog吗?使用
bot。添加cog(CogName(bot))
Yes<代码>def设置(bot):bot.添加cog(主(bot))