简体   繁体   English

如何更新多个角色的权限?

[英]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 }) .所以我想更新数组中多个角色的通道权限:据我所知,我只能使用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数组: 705044537030213675, 728956885968879667

c = channel c = 通道

You can map through the array and then call the function.你可以通过数组map然后调用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 })
})

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM