I have searched arround for a while for this but can't seem to find an answer. Does anyone know how to get the user who ran the interactions nickname, username, and user id? Thanks.
I have searched arround for a while for this but can't seem to find an answer. Does anyone know how to get the user who ran the interactions nickname, username, and user id? Thanks.
You can use the user/member properties of Interaction.
client.on('interactionCreate', async interaction => {
// Making sure the interaction is a command
if (!interaction.isCommand()) return false;
await interaction.reply(`Hello, ${interaction.user.tag}!`)
})
I'd suggest fetching the user, and then getting all the information you want.
const interactionUser = await interaction.guild.members.fetch(interaction.user.id)
const nickName = interactionUser.nickname
const userName = interactionUser.user.username
const userId = interactionUser.id
Not fetching the user explicitly may lead to missing information.