This snippet is a way to make every channel in your server update permsissions, enter the role ID you want to update on line 4 then run the command !perms and your bot will update permissions for that role in every channel. It will deny access for that role to view any channels.
const lib = require('lib')({token: process.env.STDLIB_SECRET_TOKEN});
//Enter your role ID here
let role = `ROLE ID HERE`;
//This gets a list of every channel in the server
let channels = await lib.discord.guilds['@0.2.2'].channels.list({
guild_id: `${context.params.event.guild_id}`,
});
//Makes it so it gets the id for every channel and updates every one
for (let i = 0; i < channels.length; i++) {
//The start of the api request to update the channels
await lib.discord.channels['@0.3.0'].permissions.update({
//Overwite id is the id or the role/user that you are updating permissions for
overwrite_id: `${role}`,
//Gets the channel id from the channels.list api and also loops it so it does every channel
channel_id: `${channels[i].id}`,
//This is set to deny people with the role from seeing any channel in the server
//To get more permissions go to https://discord.com/developers/docs/topics/permissions
deny: `${1 << 10}`,
//Type 0 says that it's updating a role not a user
type: 0,
});
await lib.discord.channels['@0.3.0'].messages.create({
channel_id: `${context.params.event.channel_id}`,
content: `I've updated the permissions for`,
message_reference: {message_id: `${context.params.event.id}`},
});
}