How can you do this? I have an online form with discord usernames and want to convert them to user IDs.
Couldn’t find anything online that does this. Would the most efficient way be add the user, copy id ?
Or is there a simpler soultion. thanks
How can you do this? I have an online form with discord usernames and want to convert them to user IDs.
Couldn’t find anything online that does this. Would the most efficient way be add the user, copy id ?
Or is there a simpler soultion. thanks
2
Answers
There’s currently no way to do this directly through an endpoint on the API, and they don’t play to add it as per this issue on their devrel repo.
If all of your users are in a guild of yours though, you can add a bot to it and pass each username to the Search Guild Members endpoint. This will return you a list of Guild Member Objects matching the username, which will have the user ID.
Assuming you’re using discord.js (since the tag is included)
Fetch all the guild members, then use
.find()
to get a specific member by their.tag