v3.4.3-dev #29
31
_list-guilds.js
Normal file
31
_list-guilds.js
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
/*
|
||||||
|
* Quick and dirty script to list out what guilds the bot is in and optionally leave some.
|
||||||
|
*/
|
||||||
|
|
||||||
|
const guildsToLeave = ['1219254855789711432'];
|
||||||
|
|
||||||
|
const dotenv = require('dotenv').config();
|
||||||
|
const token = process.env.TOKEN;
|
||||||
|
const Discord = require('discord.js');
|
||||||
|
|
||||||
|
const client = new Discord.Client({
|
||||||
|
intents: [
|
||||||
|
'GUILDS'
|
||||||
|
]
|
||||||
|
});
|
||||||
|
|
||||||
|
client.on('ready', async () => {
|
||||||
|
console.log(`Logged in as ${client.user.tag}`);
|
||||||
|
console.log('Guilds:');
|
||||||
|
client.guilds.cache.forEach(async (guild) => {
|
||||||
|
console.log(` - ${guild.name} (${guild.id})`);
|
||||||
|
if (guildsToLeave.includes(guild.id)) {
|
||||||
|
console.log(` Leaving ${guild.name}`);
|
||||||
|
await guild.leave();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
console.log('Done.');
|
||||||
|
client.destroy();
|
||||||
|
});
|
||||||
|
|
||||||
|
client.login(token);
|
||||||
17
main.js
17
main.js
@ -31,6 +31,7 @@ const { GifData, CommandData } = require('./CustomModules/NodBot.js');
|
|||||||
const ButtonHandlers = require('./CustomModules/ButtonHandlers.js');
|
const ButtonHandlers = require('./CustomModules/ButtonHandlers.js');
|
||||||
const InteractionStorage = require('./CustomModules/InteractionStorage.js');
|
const InteractionStorage = require('./CustomModules/InteractionStorage.js');
|
||||||
const isDev = process.env.isDev;
|
const isDev = process.env.isDev;
|
||||||
|
let statusChannel;
|
||||||
|
|
||||||
client.once('ready', async () => {
|
client.once('ready', async () => {
|
||||||
fn.collections.interactionStorage(client);
|
fn.collections.interactionStorage(client);
|
||||||
@ -48,9 +49,8 @@ client.once('ready', async () => {
|
|||||||
await fn.avWx.metar.getAllICAOs();
|
await fn.avWx.metar.getAllICAOs();
|
||||||
await fn.avWx.datis.getAllICAOs();
|
await fn.avWx.datis.getAllICAOs();
|
||||||
// console.log(JSON.stringify(icaoArray));
|
// console.log(JSON.stringify(icaoArray));
|
||||||
client.channels.fetch(statusChannelId).then(channel => {
|
statusChannel = await client.channels.fetch(statusChannelId).catch(e => console.error(e));
|
||||||
channel.send(`${new Date().toISOString()} -- <@${process.env.ownerId}>\nStartup Sequence Complete`);
|
await channel.send(`${new Date().toISOString()} -- <@${process.env.ownerId}>\nStartup Sequence Complete`).catch(e => console.error(e));
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|
||||||
// slash-commands
|
// slash-commands
|
||||||
@ -146,4 +146,15 @@ client.on('messageCreate', message => {
|
|||||||
return;
|
return;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Guild Joins and Leaves:
|
||||||
|
client.on('guildCreate', async guild => {
|
||||||
|
await statusChannel.send(`I've been added to a new guild: ${guild.name} (${guild.id})`)
|
||||||
|
.catch(e => console.error(e));
|
||||||
|
});
|
||||||
|
|
||||||
|
client.on('guildDelete', async guild => {
|
||||||
|
await statusChannel.send(`I've been removed from a guild: ${guild.name} (${guild.id})`)
|
||||||
|
.catch(e => console.error(e));
|
||||||
|
});
|
||||||
|
|
||||||
client.login(token);
|
client.login(token);
|
||||||
Loading…
Reference in New Issue
Block a user