#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}")
我正在尝试执行用户统计信息命令,它最初是作为消息事件使用,但我想使其成为命令,以便您可以看到其他用户的统计信息,但是我一直在终端中获取成员对象没有属性状态错误,这是什么?我在这段代码中做错了吗?
答案 0 :(得分:1)
您的member
对象实际上是User
类型的,因为您使用的是User
转换器。请改用Member
转换器。