#Add role from external app

25 messages · Page 1 of 1 (latest)

summer rivet
#

Hey guys! I'm developing an app that based on a questionnaire you get a different kind of "character" and we created those roles on our Discord. What I want is to change the roles based on this questionnaire result. I got a bot running right now so idk if I have to create a new bot, or a new app, or if this is possible or if discord give this permissions.

Thank you!

subtle shore
#

• What's your exact discord.js npm list discord.js and node node -v version?
• Post the full error stack trace, not just the top part!
• Show your code!
• Explain what exactly your issue is.
• Not a discord.js issue? Check out #useful-servers.

primal wren
summer rivet
#

How is this possible? Srry

#

Srry if this such a newbie thing

primal wren
#

there are lots of ways to send requests, tho none of that is really djs related

#

googling sending http requests is a good start

summer rivet
#

Ok, perfect, thank you for that @primal wren you're great 🙂

primal wren
#

no problem!

summer rivet
#

Hey @primal wren sorry for this lol, I got to send this request to my bot but now I'm not able to change the roles of the specific user. I tried to get the roles via the client.cache, but I it does not work the "roles.add("role id")" it says the function add does not exists

primal wren
#

are u trying to add it to a user?

summer rivet
#

No, to a member this is my attempt to print them because the "add" did not worked

const role = client.guilds.cache.map((selected) => {
    console.log(selected.roles);
});
primal wren
#

what does that log?

summer rivet
#

All the guild cache

#

and on roles I get this: roles: [Circular *2],

#

And this is what happens when I use "add"

TypeError: selected.roles.add is not a function

hidden axle
#

you're trying to add roles to the guild

#

you have to add it to a single member

summer rivet
#

When I use the members and I fetch one member, I could not use member.roles I could only use member._role but on that case the "add" still not a function

hidden axle
#

show what isn't working and explain how it isn't working

summer rivet
#

No, sorry my bad I made it by using "roles"

#

Sorry

#

Thank you a lot