简体   繁体   English

如何从他们的用户ID中获得不和谐服务器成员的用户名

[英]How do I get the username of a member of a discord server from their user id

I've been looking through the docs, and I found the get_members function, but when I used this function and I try to get the name or nick or nickname field, it returns an error saying that the attribute doesn't exist. 我一直在浏览文档,找到了get_members函数,但是当我使用此函数并尝试获取name或nick或nickname字段时,它返回一个错误,指出该属性不存在。 Here's my code: 这是我的代码:

embed = discord.Embed(title=ctx.message.server.get_member(row[0]).nickname,  color=embedColor)

Here's the error: 这是错误:

'NoneType' object has no attribute 'nickname'

row[0] was, in fact, not a string. 实际上,row [0]不是字符串。 And the attribute I was actually looking for was "name." 我实际上正在寻找的属性是“名称”。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM