Allows a user to see a text channel when they connect to a specific voice channel, removes the permission when they disconnect. used to allow users to see extra chats only while in a VC. Useful for No-Mic chats and more!
const lib = require('lib')({token: process.env.STDLIB_SECRET_TOKEN});
//chanel1
if (context.params.event.channel_id === `${process.env.textChannel1}`) {
await lib.discord.channels['@0.2.2'].permissions.update({
overwrite_id: `${context.params.event.member.user.id}`,
channel_id: `${process.env.vcChannel1}`,
allow: `${1 << 10}`,
type: 1,
});
//channel2
} else if (context.params.event.channel_id === `${process.env.textChannel2}`) {
await lib.discord.channels['@0.2.2'].permissions.update({
overwrite_id: `${context.params.event.member.user.id}`,
channel_id: `${process.env.vcChannel2}`,
allow: `${1 << 10}`,
type: 1,
});
//channel3
} else if (context.params.event.channel_id === `${process.env.textChannel3}`) {
await lib.discord.channels['@0.2.2'].permissions.update({
overwrite_id: `${context.params.event.member.user.id}`,
channel_id: `${process.env.vcChannel3}`,
allow: `${1 << 10}`,
type: 1,
});
} else if (context.params.event.channel_id === null) {
//channel1
await lib.discord.channels['@0.2.2'].permissions.destroy({
overwrite_id: `${context.params.event.member.user.id}`,
channel_id: `${process.env.vcChannel1}`,
});
//channel2
await lib.discord.channels['@0.2.2'].permissions.destroy({
overwrite_id: `${context.params.event.member.user.id}`,
channel_id: `${process.env.vcChannel2}`,
});
//channel3
await lib.discord.channels['@0.2.2'].permissions.destroy({
overwrite_id: `${context.params.event.member.user.id}`,
channel_id: `${process.env.vcChannel3}`,
});
} else {
console.log(`error`)
}
//MeltedButter#9266