简体   繁体   中英

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. 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. And the attribute I was actually looking for was "name."

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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