I’m trying to set the permissions role assigned to my bot upon joining the server to the highest position in the server’s role hierarchy.
I tried using setPostion
method to set the position to 1 but it doesn’t seem to work. Any idea what am I doing wrong?
Code snippet:
export const event = {
name: Events.GuildCreate,
once: false,
execute(guild) {
const bot = guild.members.me;
const role = bot.roles.cache.find((r) => r.name === "bot name")
role.setPosition(1)
};