peachy
peachy
DIAdiscord.js - Imagine an app
Created by peachy on 8/14/2023 in #djs-questions
GuildMember.setNickname weird issue
Im using a modal for my discords verify system, where they input text and that text then becomes their nickname. 90% of the time it works but then sometimes it doesn't set their nickname? There is no error and it runs the code afterwards still which gives them a role, I created logs for it and it logs the correct nickname it was meant to set it to as well. My Intents
intents: [
GatewayIntentBits.Guilds,
GatewayIntentBits.GuildMessages,
GatewayIntentBits.MessageContent,
GatewayIntentBits.GuildMembers,
],
partials: [
Partials.Message, Partials.Channel, Partials.GuildMember, Partials.User
]
intents: [
GatewayIntentBits.Guilds,
GatewayIntentBits.GuildMessages,
GatewayIntentBits.MessageContent,
GatewayIntentBits.GuildMembers,
],
partials: [
Partials.Message, Partials.Channel, Partials.GuildMember, Partials.User
]
My code
const channel = interaction.guild.channels.cache.get('1133327003337097256')
channel.send({ content: `${interaction.member}: ${nickname}`}) // Nickname logs
try {
const guildMember = await interaction.guild.members.fetch(interaction.member.id)
guildMember.setNickname(nickname);
guildMember.roles.add("1129006050641707058");
} catch (error) {
console.log(error)
}


await interaction.reply({
content: "You have been verified!",
ephemeral: true,
});
const channel = interaction.guild.channels.cache.get('1133327003337097256')
channel.send({ content: `${interaction.member}: ${nickname}`}) // Nickname logs
try {
const guildMember = await interaction.guild.members.fetch(interaction.member.id)
guildMember.setNickname(nickname);
guildMember.roles.add("1129006050641707058");
} catch (error) {
console.log(error)
}


await interaction.reply({
content: "You have been verified!",
ephemeral: true,
});
Please ping me if you can help cause I may not see it otherwise :) Thanks
13 replies