Python 3.x 尝试在discord.py 1.0.1中生成用户统计信息命令
我正在尝试创建一个用户统计命令,它最初是作为消息上的事件工作的,但我想将它创建为一个命令,以便您可以查看其他用户的统计信息,但我一直在获取成员对象在终端中没有属性状态错误,我在这段代码中做错了什么?您的Python 3.x 尝试在discord.py 1.0.1中生成用户统计信息命令,python-3.x,discord.py-rewrite,Python 3.x,Discord.py Rewrite,我正在尝试创建一个用户统计命令,它最初是作为消息上的事件工作的,但我想将它创建为一个命令,以便您可以查看其他用户的统计信息,但我一直在获取成员对象在终端中没有属性状态错误,我在这段代码中做错了什么?您的成员对象实际上是用户类型,因为您正在使用用户转换器。改用成员转换器 有一个小写的s。我试过了,它仍然说成员对象没有属性状态,还有什么问题吗?这就是问题所在,非常感谢! #Returns User stats for the server @client.command() async def us
成员
对象实际上是用户
类型,因为您正在使用用户
转换器。改用成员
转换器 有一个小写的s
。我试过了,它仍然说成员对象没有属性状态,还有什么问题吗?这就是问题所在,非常感谢!
#Returns User stats for the server
@client.command()
async def user(ctx, member:discord.User=None):
if member == None:
member = ctx.message.author
pronoun = "Your"
else:
pronoun = "Their"
name = f"{member.name}#{member.discriminator}"
status = member.Status
joined = member.joined_at
role = member.top_role
await ctx.channel.send(f"{pronoun} name is {name}, {pronoun} status is {status}, They joined at {joined}, {pronoun} rank is {role}")