skip to Main Content

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


  1. 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.

    Login or Signup to reply.
  2. 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

    const tags = ["User#0001", ...];
    const members = await <Guild>.members.fetch();
    
    const ids = tags.map(tag => members.find(memer => member.tag === tag));
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search