Add special status msg for leaving banned servers
All checks were successful
NodBot PE Dockerization / build (push) Successful in 18s

This commit is contained in:
Skylar Grant 2025-01-31 20:45:50 -05:00
parent 91982da762
commit fd60089d39
2 changed files with 5 additions and 4 deletions

View File

@ -671,8 +671,8 @@ const functions = {
});
});
},
checkBannedServers(client) {
if ( !config.bannedServers ) return;
checkBannedServers(client, statusChannel) {
if ( !config.bannedServers || !statusChannel ) return;
const guildChecks = [];
console.log('Guild Check:');
client.guilds.cache.forEach((guild) => {
@ -680,6 +680,7 @@ const functions = {
console.log(` - ${guild.name} (${guild.id})`);
if (config.bannedServers.includes(guild.id)) {
console.log(` Leaving banned server: ${guild.name}`);
statusChannel.send(`<@${process.env.OWNER_ID}> Leaving banned server: ${guild.name}`);
guild.leave().then(resolve).catch(reject);
} else {
resolve();

View File

@ -52,7 +52,7 @@ client.once('ready', async () => {
statusChannel = await client.channels.fetch(statusChannelId).catch(e => console.error(e));
await statusChannel.send(`${new Date().toISOString()} -- <@${process.env.ownerId}>\nStartup Sequence Complete`).catch(e => console.error(e));
// Check for banned servers
fn.checkBannedServers(client);
fn.checkBannedServers(client, statusChannel);
});
// slash-commands
@ -152,7 +152,7 @@ client.on('messageCreate', message => {
client.on('guildCreate', guild => {
statusChannel.send(`I've been added to a new guild: ${guild.name} (${guild.id})`)
.catch(e => console.error(e));
fn.checkBannedServers(client);
fn.checkBannedServers(client, statusChannel);
});
client.on('guildDelete', guild => {