Mystik
Mystik

Reputation: 126

How do I update permissions for multiple roles?

So I want to update channel permissions for multiple roles in an array: As far I can tell is that I can only role one role using c.updateOverwrite(Updaterole1, { VIEW_CHANNEL: true, SEND_MESSAGES: true, MANAGE_MESSAGES: true }).

How do I update permissions for multiple roles?

var Updaterole = config.ModeratorRoles.shift()
var Updaterole1 = Updaterole.toString()
c.updateOverwrite(Updaterole1, { VIEW_CHANNEL: true, SEND_MESSAGES: true, MANAGE_MESSAGES: true })

Array: 705044537030213675, 728956885968879667

c = channel

Upvotes: 0

Views: 223

Answers (1)

infecting
infecting

Reputation: 763

You can map through the array and then call the function. I am not sure what your array is called so its hard to give you a relevant code example but I can try

arrayNameHere.map((role) => {
    c.updateOverwrite(role, { VIEW_CHANNEL: true, SEND_MESSAGES: true, MANAGE_MESSAGES: true })
})

Upvotes: 1

Related Questions