Add a member to a role

Hi everyone!
I am new to Discord.js. We have a system like this:
Users become a member of the learning management system (Moodle). There are roles... The roles are the same as Discord roles... I have the nickname (or id) of the user and I know the role. I want to automatically register this user to a discord channel and assign the role automatically. I want him to see a welcome message when he comes to the channel. Is this system possible? Also, I couldn't assign the role, I tried this source:
https://github.com/AnIdiotsGuide/discordjs-bot-guide/blob/master/understanding/roles.md#add-a-member-to-a-role

However, I get an error like this:
DiscordAPIError[50013]: Missing Permissions

Thanks in advance for your help.
GitHub
The basic new coder friendly "idiot's guide", Created by Hindsight#2020 and maintained by the community. - AnIdiotsGuide/discordjs-bot-guide
Was this page helpful?