I was trying to give myself a role when executing a “/” command, and ive tryed many solutions from stackoverflow but none of them work for discord.js v14. Im pretty new to js.
tryed:
const guild = interaction.guild
const role = guild.roles.cache.find(role => role.name === 'Admin');
var dcuser = interaction.user.id
dcuser.roles.add(role)
Got:
TypeError: Cannot read properties of undefined (reading ‘add’)