Reputation: 37
I have some user tags like this one Nickname#1234
, I need to fetch the user with that tag to the bot cache, i've tried this method:
message.channel.guild.members.fetch([options])
but it only seems to work with the user ID, it's there a way to fetch the specified member without it's ID?, or get the user ID from a member which isn't in the cache?
Upvotes: 1
Views: 1602
Reputation: 921
You cannot actually fetch by a user tag because Discord Api doesn't support that yet so you can just fetch all members and find them -
message.channel.guild.members.fetch({cache : false}).then(members=>members.find(member=>member.user.tag === "Nickname#1234"))
Upvotes: 2