Reputation: 151
This isn't working:
client.users.cache.get(`${args[0]}`).id;
What should I do to fix it? I'm on v12
Upvotes: 1
Views: 1466
Reputation: 93
Try
matching_client = client.users.cache.filter(user => user.username === args[0]);
matching_client
is a Collection of users that match that username
Relevant documentation link:
https://discord.js.org/#/docs/collection/master/class/Collection?scrollTo=filter
Upvotes: 1