Reputation: 85
EDIT: Apparently it's a client-side issue so not really an issue with the code
I have an application system but the user name/tag doesn't show up right sometimes is there any way I could fix this or is it a discord issue?
It only works with some members plus it makes it a bit inconvenient to find the user that submitted the application
Sometimes it looks like this (which is wrong)
and sometimes it looks like this
I would do something like
// Create our application, we will fill it later
const application = new MessageEmbed()
.setTitle("New Application")
.setDescription(`This application was submitted by ${member}/${member.user.tag}`)
.setColor("#ED4245");
but that feels like something very stupid to do and probably would get killed by someone who has more knowledge than me with bots 😂
Upvotes: 1
Views: 830
Reputation: 2286
TL;DR : Using approach you thought of is absolutely fine and this only happens when a user isn't available to the guild or hasn't occured to the individual seeing the channel before
Usually if the user hasn't been seen before ( condition like channel access and unavailable to that guild may also apply ) by the individual viewing the channel the ID may show as is like in your case, that is due to discord maintaining only users ever seen by the individual ( this is client side not from Discord itself) to overcome this you may just add the username of the individual at the top of the application
<member>.user.tag
As you answered yourselves! Not to worry though! That's what a smart developer would think of!
Please make sure that if the user has a nickname it's a better approach to use <@!userID>
, explained here in <@userID> vs. <@!userID>, discord.js auto-parses that mention for you so in your case it's probably just one of the cases I mentioned above for which the user remains uncached at client side.
Upvotes: 1
Reputation: 1824
You can get the discord user id and tag the user by using
<@insert user id here>
Upvotes: 0