Skip to content

Instantly share code, notes, and snippets.

@EveryDayRains
Created June 5, 2020 21:10
Show Gist options
  • Save EveryDayRains/2f0b03bb110d9aa043bac59d43fbc533 to your computer and use it in GitHub Desktop.
Save EveryDayRains/2f0b03bb110d9aa043bac59d43fbc533 to your computer and use it in GitHub Desktop.
Приватные войсы на djs v12
const { categoryID, voiceID} = config
module.exports = async (client, oldState, newState) => {
if(newState.channelID === voiceID) {
newState.guild.channels.create("Комнатка ☁️", {
type: "VOICE",
parent: categoryID,
permissionOverwrites: [
{
id: newState.guild.id,
allow: ["VIEW_CHANNEL"]
},
{
id: newState.member.id,
allow: ["VIEW_CHANNEL", "MANAGE_CHANNELS"]
}
]
}).then(ch => {newState.setChannel(ch) , ch.setUserLimit(42) })
}
if(oldState.channel && !oldState.channel.members.size && oldState.channel.parentID === categoryID && oldState.channelID !== voiceID) oldState.channel.delete();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment