Discriminator turns into "0"

i am using the propierty message.author.discriminator, but it gives me an "0" of response. Here are some helpful screenshoots
No description
No description
107 Replies
d.js toolkit
d.js toolkit11mo ago
- What's your exact discord.js npm list discord.js and node node -v version? - Not a discord.js issue? Check out #other-js-ts. - Consider reading #how-to-get-help to improve your question! - Explain what exactly your issue is. - Post the full error stack trace, not just the top part! - Show your code! - Issue solved? Press the button! - Marked as resolved by OP
Unknown User
Unknown User11mo ago
Message Not Public
Sign In & Join Server To View
drexxdv
drexxdvOP11mo ago
wat huh but haves an tag, no? and
Unknown User
Unknown User11mo ago
Message Not Public
Sign In & Join Server To View
drexxdv
drexxdvOP11mo ago
i wanna do to send the username with no mention
Unknown User
Unknown User11mo ago
Message Not Public
Sign In & Join Server To View
drexxdv
drexxdvOP11mo ago
how
Unknown User
Unknown User11mo ago
Message Not Public
Sign In & Join Server To View
drexxdv
drexxdvOP11mo ago
its a string?
Unknown User
Unknown User11mo ago
Message Not Public
Sign In & Join Server To View
GhostFilms
GhostFilms11mo ago
If they have a discriminator isn’t their username just their normal username+ discriminator?
Unknown User
Unknown User11mo ago
Message Not Public
Sign In & Join Server To View
GhostFilms
GhostFilms11mo ago
John#0001 Is actually John0001
Unknown User
Unknown User11mo ago
Message Not Public
Sign In & Join Server To View
GhostFilms
GhostFilms11mo ago
Ah okay
Unknown User
Unknown User11mo ago
Message Not Public
Sign In & Join Server To View
drexxdv
drexxdvOP11mo ago
lets test
GhostFilms
GhostFilms11mo ago
I just figured that since when you look at a user who has not changed it displays as such
drexxdv
drexxdvOP11mo ago
it says tag
Unknown User
Unknown User11mo ago
Message Not Public
Sign In & Join Server To View
drexxdv
drexxdvOP11mo ago
and i dont want that
Unknown User
Unknown User11mo ago
Message Not Public
Sign In & Join Server To View
drexxdv
drexxdvOP11mo ago
No description
Unknown User
Unknown User11mo ago
Message Not Public
Sign In & Join Server To View
drexxdv
drexxdvOP11mo ago
ye
GhostFilms
GhostFilms11mo ago
Just to ask what is output look like
Unknown User
Unknown User11mo ago
Message Not Public
Sign In & Join Server To View
drexxdv
drexxdvOP11mo ago
my username is Trumbus and its says trumbus__
Unknown User
Unknown User11mo ago
Message Not Public
Sign In & Join Server To View
d.js docs
d.js docs11mo ago
:property: User#displayName The global name of this user, or their username if they don't have one
GhostFilms
GhostFilms11mo ago
Your display name is Trumbus and username is trumbus__
drexxdv
drexxdvOP11mo ago
some tests xD
No description
Unknown User
Unknown User11mo ago
Message Not Public
Sign In & Join Server To View
drexxdv
drexxdvOP11mo ago
i can type displayName ?
Unknown User
Unknown User11mo ago
Message Not Public
Sign In & Join Server To View
drexxdv
drexxdvOP11mo ago
idk what to type on code
Unknown User
Unknown User11mo ago
Message Not Public
Sign In & Join Server To View
GhostFilms
GhostFilms11mo ago
^ That will output Trumbus instead
drexxdv
drexxdvOP11mo ago
No description
drexxdv
drexxdvOP11mo ago
thats wat i want and it worked it does
Unknown User
Unknown User11mo ago
Message Not Public
Sign In & Join Server To View
drexxdv
drexxdvOP11mo ago
slash commands it doesnt work
Unknown User
Unknown User11mo ago
Message Not Public
Sign In & Join Server To View
drexxdv
drexxdvOP11mo ago
and i have an interactionCreate
Unknown User
Unknown User11mo ago
Message Not Public
Sign In & Join Server To View
drexxdv
drexxdvOP11mo ago
i have regisetred
Unknown User
Unknown User11mo ago
Message Not Public
Sign In & Join Server To View
GhostFilms
GhostFilms11mo ago
What is your error?
Unknown User
Unknown User11mo ago
Message Not Public
Sign In & Join Server To View
drexxdv
drexxdvOP11mo ago
No-Response
Unknown User
Unknown User11mo ago
Message Not Public
Sign In & Join Server To View
GhostFilms
GhostFilms11mo ago
Code?
drexxdv
drexxdvOP11mo ago
client.on('interactionCreate', async interaction => {
const commandName = interaction;
if (commandName === 'perfil') {
const userProfile = new EmbedBuilder()
.setName(`Perfil de ${interaction.member.tag}`)
.setColor('#dc5959')
.setThumbnail(interaction.member.displayAvatarURL({ dynamic: true }))
.setDescription(`**Nombre de usuario**\n<@${interaction.member.id}>\n**Tag**\n${interaction.member.tag}`);
await interaction.reply({ embeds: [userProfile]})
}
});
client.on('interactionCreate', async interaction => {
const commandName = interaction;
if (commandName === 'perfil') {
const userProfile = new EmbedBuilder()
.setName(`Perfil de ${interaction.member.tag}`)
.setColor('#dc5959')
.setThumbnail(interaction.member.displayAvatarURL({ dynamic: true }))
.setDescription(`**Nombre de usuario**\n<@${interaction.member.id}>\n**Tag**\n${interaction.member.tag}`);
await interaction.reply({ embeds: [userProfile]})
}
});
Unknown User
Unknown User11mo ago
Message Not Public
Sign In & Join Server To View
d.js docs
d.js docs11mo ago
:mdn: Destructuring assignment The destructuring assignment syntax is a JavaScript expression that makes it possible to unpack values from arrays, or properties from objects, into distinct variables.
Unknown User
Unknown User11mo ago
Message Not Public
Sign In & Join Server To View
drexxdv
drexxdvOP11mo ago
i deleted the definition of commandName
Unknown User
Unknown User11mo ago
Message Not Public
Sign In & Join Server To View
drexxdv
drexxdvOP11mo ago
No description
Unknown User
Unknown User11mo ago
Message Not Public
Sign In & Join Server To View
drexxdv
drexxdvOP11mo ago
wat i need to do
Unknown User
Unknown User11mo ago
Message Not Public
Sign In & Join Server To View
drexxdv
drexxdvOP11mo ago
desestructure
Unknown User
Unknown User11mo ago
Message Not Public
Sign In & Join Server To View
drexxdv
drexxdvOP11mo ago
no much i am new
Unknown User
Unknown User11mo ago
Message Not Public
Sign In & Join Server To View
GhostFilms
GhostFilms11mo ago
And we’re not being mean we’re just saying that it will be much easier if you try and learn as much js before stepping into discord.js
drexxdv
drexxdvOP11mo ago
that no help
Unknown User
Unknown User11mo ago
Message Not Public
Sign In & Join Server To View
drexxdv
drexxdvOP11mo ago
im gonna try other think i have a code, that it uses that code if i copy of that i can get a good code
Unknown User
Unknown User11mo ago
Message Not Public
Sign In & Join Server To View
GhostFilms
GhostFilms11mo ago
^
drexxdv
drexxdvOP11mo ago
i never think of {} was my fault
Unknown User
Unknown User11mo ago
Message Not Public
Sign In & Join Server To View
GhostFilms
GhostFilms11mo ago
This is the same as const commandName = interaction.commandName It’s nice to destruct it because you can do many variables at once
drexxdv
drexxdvOP11mo ago
lets try now
GhostFilms
GhostFilms11mo ago
I also think it looks nicer but that’s just preference
drexxdv
drexxdvOP11mo ago
the slash works
GhostFilms
GhostFilms11mo ago
Make sure you read the guide it really helps and is fairly beginner friendly
drexxdv
drexxdvOP11mo ago
yes
d.js docs
d.js docs11mo ago
:guide: Home: What's new read more
drexxdv
drexxdvOP11mo ago
i register globally the slash now works
GhostFilms
GhostFilms11mo ago
That’s fine global registration takes some time though remember that
Unknown User
Unknown User11mo ago
Message Not Public
Sign In & Join Server To View
GhostFilms
GhostFilms11mo ago
Really that’s nice
Unknown User
Unknown User11mo ago
Message Not Public
Sign In & Join Server To View
drexxdv
drexxdvOP11mo ago
try {
const commandObjects = await client.application?.commands.set(commands);
if (commandObjects) {
console.log('Se han registrado los siguientes slash commands:', commandObjects.map(command => command.name).join(', '));
} else {
console.error('No se pudo crear los comandos');
}
} catch (error) {
console.error('Error al crear los comandos:', error);
}
try {
const commandObjects = await client.application?.commands.set(commands);
if (commandObjects) {
console.log('Se han registrado los siguientes slash commands:', commandObjects.map(command => command.name).join(', '));
} else {
console.error('No se pudo crear los comandos');
}
} catch (error) {
console.error('Error al crear los comandos:', error);
}
d.js docs
d.js docs11mo ago
Suggestion for @Trumbus: :guide: Creating Your Bot: Registering slash commands read more
drexxdv
drexxdvOP11mo ago
i registered with this code
Unknown User
Unknown User11mo ago
Message Not Public
Sign In & Join Server To View
drexxdv
drexxdvOP11mo ago
? i used that code
Unknown User
Unknown User11mo ago
Message Not Public
Sign In & Join Server To View
drexxdv
drexxdvOP11mo ago
on other bots
Unknown User
Unknown User11mo ago
Message Not Public
Sign In & Join Server To View
GhostFilms
GhostFilms11mo ago
Yeah you should only register your commands separately when you make changes or add commands I don’t even have it part of my bot so I just run it when I need to
drexxdv
drexxdvOP11mo ago
i can use a prefix command to that?
Unknown User
Unknown User11mo ago
Message Not Public
Sign In & Join Server To View
GhostFilms
GhostFilms11mo ago
Should also move away from prefix commands in my opinion
drexxdv
drexxdvOP11mo ago
use a prefix command, to use the code for registering slash commands
Unknown User
Unknown User11mo ago
Message Not Public
Sign In & Join Server To View
GhostFilms
GhostFilms11mo ago
No I think he is saying he has a prefix command that registers his slash commands
drexxdv
drexxdvOP11mo ago
^
Unknown User
Unknown User11mo ago
Message Not Public
Sign In & Join Server To View
GhostFilms
GhostFilms11mo ago
^
drexxdv
drexxdvOP11mo ago
nah
Unknown User
Unknown User11mo ago
Message Not Public
Sign In & Join Server To View
drexxdv
drexxdvOP11mo ago
i gotta mark now this thread haves so much messages

Did you find this page helpful?