autoleave non-authorized guilds
This commit is contained in:
parent
5582bcc8c3
commit
dba2478a9a
|
@ -1,7 +1,8 @@
|
|||
{
|
||||
"discord": {
|
||||
"token": "",
|
||||
"authorized_channels": [""]
|
||||
"authorized_channels": [""],
|
||||
"authorized_guilds": [""]
|
||||
},
|
||||
"openai": {
|
||||
"key": "",
|
||||
|
|
9
index.js
9
index.js
|
@ -69,6 +69,15 @@ client.on("ready", () => {
|
|||
console.error(error);
|
||||
}
|
||||
})();
|
||||
|
||||
// Automatically leave servers that aren't in the authorized channels list
|
||||
console.log(`${colors.cyan("[INFO]")} Leaving Servers...`)
|
||||
client.guilds.cache.forEach((guild) => {
|
||||
if (!config.discord.authorized_guilds.includes(guild.id)) {
|
||||
guild.leave();
|
||||
console.log(`${colors.cyan("[INFO]")} Left ${colors.green(guild.name)}`)
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
client.on('interactionCreate', async (interaction) => {
|
||||
|
|
Loading…
Reference in a new issue