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 toolkit10mo 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 User10mo ago
Message Not Public
Sign In & Join Server To View
drexxdv
drexxdvOP10mo ago
wat huh but haves an tag, no? and
Unknown User
Unknown User10mo ago
Message Not Public
Sign In & Join Server To View
drexxdv
drexxdvOP10mo ago
i wanna do to send the username with no mention
Unknown User
Unknown User10mo ago
Message Not Public
Sign In & Join Server To View
drexxdv
drexxdvOP10mo ago
how
Unknown User
Unknown User10mo ago
Message Not Public
Sign In & Join Server To View
drexxdv
drexxdvOP10mo ago
its a string?
Unknown User
Unknown User10mo ago
Message Not Public
Sign In & Join Server To View
GhostFilms
GhostFilms10mo ago
If they have a discriminator isn’t their username just their normal username+ discriminator?
Unknown User
Unknown User10mo ago
Message Not Public
Sign In & Join Server To View
GhostFilms
GhostFilms10mo ago
John#0001 Is actually John0001
Unknown User
Unknown User10mo ago
Message Not Public
Sign In & Join Server To View
GhostFilms
GhostFilms10mo ago
Ah okay
Unknown User
Unknown User10mo ago
Message Not Public
Sign In & Join Server To View
drexxdv
drexxdvOP10mo ago
lets test
GhostFilms
GhostFilms10mo ago
I just figured that since when you look at a user who has not changed it displays as such
drexxdv
drexxdvOP10mo ago
it says tag
Unknown User
Unknown User10mo ago
Message Not Public
Sign In & Join Server To View
drexxdv
drexxdvOP10mo ago
and i dont want that
Unknown User
Unknown User10mo ago
Message Not Public
Sign In & Join Server To View
drexxdv
drexxdvOP10mo ago
No description
Unknown User
Unknown User10mo ago
Message Not Public
Sign In & Join Server To View
drexxdv
drexxdvOP10mo ago
ye
GhostFilms
GhostFilms10mo ago
Just to ask what is output look like
Unknown User
Unknown User10mo ago
Message Not Public
Sign In & Join Server To View
drexxdv
drexxdvOP10mo ago
my username is Trumbus and its says trumbus__
Unknown User
Unknown User10mo ago
Message Not Public
Sign In & Join Server To View
d.js docs
d.js docs10mo ago
:property: User#displayName The global name of this user, or their username if they don't have one
GhostFilms
GhostFilms10mo ago
Your display name is Trumbus and username is trumbus__
drexxdv
drexxdvOP10mo ago
some tests xD
No description
Unknown User
Unknown User10mo ago
Message Not Public
Sign In & Join Server To View
drexxdv
drexxdvOP10mo ago
i can type displayName ?
Unknown User
Unknown User10mo ago
Message Not Public
Sign In & Join Server To View
drexxdv
drexxdvOP10mo ago
idk what to type on code
Unknown User
Unknown User10mo ago
Message Not Public
Sign In & Join Server To View
GhostFilms
GhostFilms10mo ago
^ That will output Trumbus instead
drexxdv
drexxdvOP10mo ago
No description
drexxdv
drexxdvOP10mo ago
thats wat i want and it worked it does
Unknown User
Unknown User10mo ago
Message Not Public
Sign In & Join Server To View
drexxdv
drexxdvOP10mo ago
slash commands it doesnt work
Unknown User
Unknown User10mo ago
Message Not Public
Sign In & Join Server To View
drexxdv
drexxdvOP10mo ago
and i have an interactionCreate
Unknown User
Unknown User10mo ago
Message Not Public
Sign In & Join Server To View
drexxdv
drexxdvOP10mo ago
i have regisetred
Unknown User
Unknown User10mo ago
Message Not Public
Sign In & Join Server To View
GhostFilms
GhostFilms10mo ago
What is your error?
Unknown User
Unknown User10mo ago
Message Not Public
Sign In & Join Server To View
drexxdv
drexxdvOP10mo ago
No-Response
Unknown User
Unknown User10mo ago
Message Not Public
Sign In & Join Server To View
GhostFilms
GhostFilms10mo ago
Code?
drexxdv
drexxdvOP10mo 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 User10mo ago
Message Not Public
Sign In & Join Server To View
d.js docs
d.js docs10mo 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 User10mo ago
Message Not Public
Sign In & Join Server To View
drexxdv
drexxdvOP10mo ago
i deleted the definition of commandName
Unknown User
Unknown User10mo ago
Message Not Public
Sign In & Join Server To View
drexxdv
drexxdvOP10mo ago
No description
Unknown User
Unknown User10mo ago
Message Not Public
Sign In & Join Server To View
drexxdv
drexxdvOP10mo ago
wat i need to do
Unknown User
Unknown User10mo ago
Message Not Public
Sign In & Join Server To View
drexxdv
drexxdvOP10mo ago
desestructure
Unknown User
Unknown User10mo ago
Message Not Public
Sign In & Join Server To View
drexxdv
drexxdvOP10mo ago
no much i am new
Unknown User
Unknown User10mo ago
Message Not Public
Sign In & Join Server To View
GhostFilms
GhostFilms10mo 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
drexxdvOP10mo ago
that no help
Unknown User
Unknown User10mo ago
Message Not Public
Sign In & Join Server To View
drexxdv
drexxdvOP10mo 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 User10mo ago
Message Not Public
Sign In & Join Server To View
GhostFilms
GhostFilms10mo ago
^
drexxdv
drexxdvOP10mo ago
i never think of {} was my fault
Unknown User
Unknown User10mo ago
Message Not Public
Sign In & Join Server To View
GhostFilms
GhostFilms10mo 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
drexxdvOP10mo ago
lets try now
GhostFilms
GhostFilms10mo ago
I also think it looks nicer but that’s just preference
drexxdv
drexxdvOP10mo ago
the slash works
GhostFilms
GhostFilms10mo ago
Make sure you read the guide it really helps and is fairly beginner friendly
drexxdv
drexxdvOP10mo ago
yes
d.js docs
d.js docs10mo ago
:guide: Home: What's new read more
drexxdv
drexxdvOP10mo ago
i register globally the slash now works
GhostFilms
GhostFilms10mo ago
That’s fine global registration takes some time though remember that
Unknown User
Unknown User10mo ago
Message Not Public
Sign In & Join Server To View
GhostFilms
GhostFilms10mo ago
Really that’s nice
Unknown User
Unknown User10mo ago
Message Not Public
Sign In & Join Server To View
drexxdv
drexxdvOP10mo 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 docs10mo ago
Suggestion for @Trumbus: :guide: Creating Your Bot: Registering slash commands read more
drexxdv
drexxdvOP10mo ago
i registered with this code
Unknown User
Unknown User10mo ago
Message Not Public
Sign In & Join Server To View
drexxdv
drexxdvOP10mo ago
? i used that code
Unknown User
Unknown User10mo ago
Message Not Public
Sign In & Join Server To View
drexxdv
drexxdvOP10mo ago
on other bots
Unknown User
Unknown User10mo ago
Message Not Public
Sign In & Join Server To View
GhostFilms
GhostFilms10mo 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
drexxdvOP10mo ago
i can use a prefix command to that?
Unknown User
Unknown User10mo ago
Message Not Public
Sign In & Join Server To View
GhostFilms
GhostFilms10mo ago
Should also move away from prefix commands in my opinion
drexxdv
drexxdvOP10mo ago
use a prefix command, to use the code for registering slash commands
Unknown User
Unknown User10mo ago
Message Not Public
Sign In & Join Server To View
GhostFilms
GhostFilms10mo ago
No I think he is saying he has a prefix command that registers his slash commands
drexxdv
drexxdvOP10mo ago
^
Unknown User
Unknown User10mo ago
Message Not Public
Sign In & Join Server To View
GhostFilms
GhostFilms10mo ago
^
drexxdv
drexxdvOP10mo ago
nah
Unknown User
Unknown User10mo ago
Message Not Public
Sign In & Join Server To View
drexxdv
drexxdvOP10mo ago
i gotta mark now this thread haves so much messages
Want results from more Discord servers?
Add your server