diff --git a/XiaoBot.js b/XiaoBot.js index 48d8368d..ad26c380 100644 --- a/XiaoBot.js +++ b/XiaoBot.js @@ -9,6 +9,7 @@ const client = new CommandoClient({ unknownCommandResponse: false, disabledEvents: ['TYPING_START'] }); +const whitelist = require('./assets/json/whitelist'); client.registry .registerDefaultTypes() @@ -48,6 +49,11 @@ client.on('ready', () => { ]; client.user.setActivity(activities[Math.floor(Math.random() * activities.length)]); }, 60000); + for (const guild of client.guilds.values()) { + if (whitelist.includes(guild.id)) continue; + console.log(`[LEAVE] Leaving guild ${guild.name}.`); + guild.leave().catch(err => console.error(`[LEAVE] Failed to leave ${guild.name}.`, err)); + } }); client.on('disconnect', event => { diff --git a/assets/json/whitelist.json b/assets/json/whitelist.json new file mode 100644 index 00000000..ca739ad5 --- /dev/null +++ b/assets/json/whitelist.json @@ -0,0 +1,13 @@ +[ + "252317073814978561", + "353661927056211970", + "317042872543346689", + "346450651326185475", + "355017633906819073", + "228598099549880320", + "320631716538613760", + "280525180411969536", + "348616424803008513", + "224249138982813696", + "319959788400148481" +] diff --git a/commands/util/info.js b/commands/util/info.js index 67bc46bf..fde842e6 100644 --- a/commands/util/info.js +++ b/commands/util/info.js @@ -18,7 +18,6 @@ module.exports = class InfoCommand extends Command { async run(msg) { const guilds = await this.client.shard.fetchClientValues('guilds.size'); - const invite = await this.client.generateInvite('1345846343'); const embed = new MessageEmbed() .setColor(0x00AE86) .setFooter('©2017 dragonfire535#8081') @@ -27,7 +26,7 @@ module.exports = class InfoCommand extends Command { .addField('❯ Home Server', `[Here](https://${this.client.options.invite})`, true) .addField('❯ Invite', - `[Here](${invite})`, true) + 'N/A', true) .addField('❯ Shards', this.client.options.shardCount, true) .addField('❯ Commands', diff --git a/commands/util/invite.js b/commands/util/invite.js deleted file mode 100644 index 65381789..00000000 --- a/commands/util/invite.js +++ /dev/null @@ -1,25 +0,0 @@ -const { Command } = require('discord.js-commando'); -const { stripIndents } = require('common-tags'); - -module.exports = class InviteCommand extends Command { - constructor(client) { - super(client, { - name: 'invite', - aliases: ['invite-link'], - group: 'util', - memberName: 'invite', - description: 'Responds with an invite for the bot and an invite to the home server.', - guarded: true - }); - } - - async run(msg) { - const invite = await this.client.generateInvite('1345846343'); - return msg.say(stripIndents` - Add me to your server with this link: - <${invite}> - Or, come to my server with this link: - https://${this.client.options.invite} - `); - } -};