Escape Character causing issue in fetching user info

I'm trying to fetch member info using the globalName of users but if a globalName contains a escape character it fails to fetch the info.
[ 'GMDMCD', 'Adi\\_918' ]
[ 'GMDMCD', 'Adi\\_918' ]
let user = client.users.cache.find(user => user.globalName == racers[0]);
let user = client.users.cache.find(user => user.globalName == racers[0]);
for the first name this code is able to fetch member info but fails for second one.
5 Replies
d.js toolkit
d.js toolkit9mo ago
- What's your exact discord.js npm list discord.js and node node -v version? - Not a discord.js issue? Check out #other-js-ts. - Consider reading #how-to-get-help to improve your question! - Explain what exactly your issue is. - Post the full error stack trace, not just the top part! - Show your code! - Issue solved? Press the button!
Parogo_72
Parogo_729mo ago
1.- you arent fetching anything 2.- you cant fetch by name You cant get a user by their name unless its cached (the bot received an event regarding that user)
GMDMCD
GMDMCD9mo ago
for first name I'm gettig complete user information
Parogo_72
Parogo_729mo ago
You cant get a user by their name unless its cached (the bot received an event regarding that user)
GMDMCD
GMDMCD9mo ago
Thanks got it working I cached all members using guild.members.fetch() and removed '\' from name to fetch the user