Getting a Discord user ID from a username can be a bit extra difficult than it sounds. The choice for doing so is in fact concealed behind the developer setups in Dissonance. This article will show you how to obtain a user ID on Disharmony from a username.
Firstly, you must locate an individual ID in Disharmony. To do so, you'll need to allow Developer Mode. We'll initially show you how to do that and then cover how to discover an individual ID.
These steps relate to both the desktop computer application and also the internet variation of Dissonance.
1. In Discord, click the equipment symbol next to your name at the reduced left edge.
2. Click Appearance under Application Settings on the left-hand side (you may have to scroll down).
3. In the Appearance settings, scroll completely to the bottom and allow Developer Mode by clicking the button to the right of it.
4. In the Users section of any Disharmony web server, locate your username as well as best click it and afterward choose Duplicate ID.
5. Paste (Ctrl+ V) the ID anywhere like a notepad or even the Discord chat to see your Disharmony User ID.
Secondly, you are required to collect the user from your customer, like below.
const Discord = require("discord.js"); const client = new Discord.Client(); //This return the username of the specified user ID. const user = client.users.cache.get("USERID"); if (!user) return console.log("Couldn't find the user"); console.log(user.username)
Finally, you can use the adhering to code to obtain Discord individual ID from the username.
discord.utils.get(client.get_all_members(), name="ExampleUser", discriminator="123456").id
Please note that the .id at the end gives you the ID of that person. Also for the discriminator part, please don't consist of the hash( #).