1

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)

enter image description here

and sometimes it looks like this

enter image description here

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

foreverlost
  • 95
  • 1
  • 1
  • 9

2 Answers2

1

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.

Zero
  • 2,164
  • 1
  • 9
  • 28
  • ahh that would make sense, didn't even think of that but I'll just let my staff know they need to scroll through the user list if it only shows the ID (that usually fixed it for me) – foreverlost Sep 03 '21 at 12:36
  • 1
    EXACTLY cuz then that user is occuring for them and getting pushed to their cache, glad I could be of help ☺️ – Zero Sep 03 '21 at 13:03
  • thanks btw really appreciate it, was really thinking it was something wrong with the code lmao, my guess was because I'm using ```client.api``` calls but it clearly wasn't haha (I know some people don't recommend using it but I will probably change it sometime) – foreverlost Sep 03 '21 at 13:13
0

You can get the discord user id and tag the user by using

<@insert user id here>
pxDav
  • 1,498
  • 9
  • 18
  • I know but sometimes the ID that came through on the applications becomes @Unkown User Im kind of guessing this is just a limitation due to the user id changing if the user changes their name and tag, but I might be wrong because sometimes the user id works fine but sometimes it comes up as an unknow user – foreverlost Sep 03 '21 at 11:30
  • 3
    User IDs remain static they do not change. – Zero Sep 03 '21 at 12:12