#Getting display_name from user ID
1 messages · Page 1 of 1 (latest)
Well NoneType would mean that your variable isn’t a Member or User, so you’ll need to check how you’re attempting to fetch the user to begin with
ctx.guild.get_member(id)
this is for a command, it generates leaderboard for an xp system
and currently it displays username with tags, but I want it to show the display name
Yeah but if it’s complaining that it’s NoneType, then you didn’t actually fetch the user for some reason. A more complete code snippet (enclosed in code blocks, or in a gist or other pastebin type link) would be helpful
Okay, so presumably name is a Member object; it’s using str conversion here which is why it shows up as User#Discriminator
What about name.mention? That way your output will always be the user’s current display name
yeah that'd be okay, but it's kinda awkward that everytime someone asks for the leaderboard 30 members will get tagged 😄
Put it in an embed and they won’t get tagged. Alternatively, there’s an “allowed_mentions” option for send that won’t ping users; check the docs for exact syntax