Lots of changes

This commit is contained in:
dragonfire535
2017-10-07 11:18:08 -04:00
parent e81226dbd6
commit a006a8a8de
32 changed files with 68 additions and 53 deletions
+34 -23
View File
@@ -12,24 +12,25 @@ const client = new CommandoClient({
messageSweepInterval: 120
});
const { postStats } = require('./structures/Util');
const whitelist = ['110373943822540800', '264445053596991498'];
const { version } = require('./package');
const whitelist = require('./assets/json/whitelist');
client.registry
.registerDefaultTypes()
.registerTypesIn(path.join(__dirname, 'types'))
.registerGroups([
['util', 'Utility'],
['guild-info', 'Server Info'],
['guild-info', 'Server Information'],
['moderation', 'Moderation'],
['random-res', 'Random Response'],
['random-img', 'Random Image'],
['single-res', 'Single Response'],
['image-edit', 'Image Manipulation'],
['avatar-edit', 'Avatar Manipulation'],
['text-edit', 'Text Manipulation'],
['num-edit', 'Number Manipulation'],
['search', 'Search'],
['games', 'Games'],
['random', 'Random/Other'],
['other', 'Other'],
['roleplay', 'Roleplay']
])
.registerDefaultCommands({
@@ -42,24 +43,7 @@ client.registry
client.on('ready', () => {
console.log(`[READY] Shard ${client.shard.id} logged in as ${client.user.tag}! (${client.user.id})`);
client.setInterval(() => {
const activities = [
`${COMMAND_PREFIX}help for commands`,
`Shard ${client.shard.id}`,
'with dragonfire535',
client.options.invite,
`with ${client.registry.commands.size} commands`,
'Rune Factory 4'
];
client.user.setActivity(activities[Math.floor(Math.random() * activities.length)]);
}, 60000);
for (const guild of client.guilds.values()) {
if (whitelist.includes(guild.id)) continue;
if (guild.members.filter(member => member.user.bot).size > 25) {
console.log(`[LEAVE] Leaving guild ${guild.name}. (${guild.id})`);
guild.leave().catch(err => console.error(`[LEAVE] Failed to leave guild ${guild.name}. (${guild.id}) ${err}`));
}
}
client.setActivity(`${COMMAND_PREFIX}help for commands`);
});
client.on('disconnect', event => {
@@ -91,7 +75,18 @@ client.dispatcher.addInhibitor(msg => {
return false;
});
client.login(TOKEN);
client.setInterval(() => {
const activities = [
`${COMMAND_PREFIX}help for commands`,
`Shard ${client.shard.id}`,
'with dragonfire535',
client.options.invite,
`with ${client.registry.commands.size} commands`,
`v${version}`,
'Rune Factory 4'
];
client.user.setActivity(activities[Math.floor(Math.random() * activities.length)]);
}, 60000);
client.setInterval(async () => {
const guilds = await client.shard.fetchClientValues('guilds.size');
@@ -99,11 +94,27 @@ client.setInterval(async () => {
postStats(count, client.user.id);
}, 300000);
client.setInterval(async () => {
for (const guild of client.guilds.values()) {
if (whitelist.includes(guild.id)) continue;
if (guild.members.filter(member => member.user.bot).size > 25) {
try {
console.log(`[LEAVE] Leaving guild ${guild.name}. (${guild.id})`);
await guild.leave();
} catch (err) {
console.error(`[LEAVE] Failed to leave guild ${guild.name}. (${guild.id}) ${err}`);
}
}
}
}, 900000);
client.setInterval(() => {
console.log(`[RESTART] Shard ${client.shard.id} restarted!`);
process.exit(0);
}, 8.64e+7);
client.login(TOKEN);
process.on('unhandledRejection', err => {
console.error('[FATAL] Unhandled Promise Rejection:', err);
process.exit(1);
+4
View File
@@ -0,0 +1,4 @@
[
"110373943822540800",
"264445053596991498"
]
@@ -8,7 +8,7 @@ module.exports = class AstronomyPictureOfTheDayCommand extends Command {
super(client, {
name: 'astronomy-picture-of-the-day',
aliases: ['nasa-apod', 'apod', 'nasa-astronomy-picture-of-the-day'],
group: 'random',
group: 'other',
memberName: 'astronomy-picture-of-the-day',
description: 'Responds with today\'s Astronomy Picture of the Day.',
clientPermissions: ['ATTACH_FILES']
@@ -5,7 +5,7 @@ module.exports = class AvatarCommand extends Command {
super(client, {
name: 'avatar',
aliases: ['profile-picture', 'profile-pic'],
group: 'random',
group: 'other',
memberName: 'avatar',
description: 'Responds with a link to a user\'s avatar.',
args: [
@@ -4,7 +4,7 @@ module.exports = class CoolnessCommand extends Command {
constructor(client) {
super(client, {
name: 'coolness',
group: 'random',
group: 'other',
memberName: 'coolness',
description: 'Determines your coolness.',
args: [
@@ -5,7 +5,7 @@ module.exports = class DaysUntilCommand extends Command {
super(client, {
name: 'days-until',
aliases: ['days-until-christmas'],
group: 'random',
group: 'other',
memberName: 'days-until',
description: 'Responds with how many days until a certain date this year.',
args: [
@@ -6,7 +6,7 @@ module.exports = class DiscriminatorCommand extends Command {
super(client, {
name: 'discriminator',
aliases: ['discrim', 'search-discrim', 'search-discriminator'],
group: 'search',
group: 'other',
memberName: 'discriminator',
description: 'Searches for other users with a certain discriminator.',
clientPermissions: ['EMBED_LINKS'],
@@ -5,7 +5,7 @@ module.exports = class EmojiImageCommand extends Command {
super(client, {
name: 'emoji-image',
aliases: ['bigify-emoji', 'emoji-url', 'big-emoji'],
group: 'guild-info',
group: 'other',
memberName: 'emoji-image',
description: 'Responds with an emoji\'s full-scale image.',
guildOnly: true,
@@ -6,7 +6,7 @@ module.exports = class GenderGuessCommand extends Command {
super(client, {
name: 'gender-guess',
aliases: ['gender', 'guess-gender'],
group: 'random',
group: 'other',
memberName: 'gender',
description: 'Determines the gender of name.',
args: [
@@ -8,7 +8,7 @@ module.exports = class HoroscopeCommand extends Command {
constructor(client) {
super(client, {
name: 'horoscope',
group: 'random',
group: 'other',
memberName: 'horoscope',
description: 'Responds with today\'s horoscope for a particular sign.',
details: `**Signs:** ${signs.join(', ')}`,
@@ -5,7 +5,7 @@ module.exports = class LMGTFYCommand extends Command {
super(client, {
name: 'lmgtfy',
aliases: ['let-me-google-that-for-you', 'google'],
group: 'random',
group: 'other',
memberName: 'lmgtfy',
description: 'Creates a LMGTFY link with the query you provide.',
args: [
@@ -7,7 +7,7 @@ module.exports = class ShortenURLCommand extends Command {
super(client, {
name: 'shorten-url',
aliases: ['short-url', 'url-shorten', 'url-short'],
group: 'random',
group: 'other',
memberName: 'shorten-url',
description: 'Creates a goo.gl short URL from another URL.',
args: [
@@ -8,7 +8,7 @@ module.exports = class SoundboardCommand extends Command {
super(client, {
name: 'soundboard',
aliases: ['sound'],
group: 'random',
group: 'other',
memberName: 'soundboard',
description: 'Plays a sound in your voice channel.',
details: `**Sounds:** ${sounds.join(', ')}`,
@@ -6,7 +6,7 @@ module.exports = class SpoopyLinkCommand extends Command {
constructor(client) {
super(client, {
name: 'spoopy-link',
group: 'random',
group: 'other',
memberName: 'spoopy-link',
description: 'Checks if a link is spoopy or not.',
args: [
@@ -7,7 +7,7 @@ module.exports = class StrawpollCommand extends Command {
super(client, {
name: 'strawpoll',
aliases: ['poll'],
group: 'random',
group: 'other',
memberName: 'strawpoll',
description: 'Creates a Strawpoll from the options you provide.',
args: [
@@ -13,7 +13,7 @@ module.exports = class TableflipCommand extends Command {
super(client, {
name: 'tableflip',
aliases: ['a-tableflip', 'animated-tableflip', 'tableflip-animated', 'tableflip-a'],
group: 'random',
group: 'other',
memberName: 'tableflip',
description: 'Flips a table... With animation!'
});
@@ -8,7 +8,7 @@ module.exports = class WordOfTheDayCommand extends Command {
super(client, {
name: 'word-of-the-day',
aliases: ['wordnik-word-of-the-day'],
group: 'random',
group: 'other',
memberName: 'word-of-the-day',
description: 'Gets the word of the day.'
});
@@ -7,7 +7,7 @@ module.exports = class XKCDCommand extends Command {
super(client, {
name: 'xkcd',
aliases: ['kcd'],
group: 'random',
group: 'other',
memberName: 'xkcd',
description: 'Gets an XKCD Comic, optionally opting for today\'s or a specific number.',
clientPermissions: ['EMBED_LINKS'],
@@ -6,7 +6,7 @@ module.exports = class CatCommand extends Command {
super(client, {
name: 'cat',
aliases: ['neko', 'kitty'],
group: 'random-img',
group: 'random-res',
memberName: 'cat',
description: 'Responds with a random cat image.',
clientPermissions: ['ATTACH_FILES']
@@ -6,7 +6,7 @@ module.exports = class DogCommand extends Command {
super(client, {
name: 'dog',
aliases: ['puppy'],
group: 'random-img',
group: 'random-res',
memberName: 'dog',
description: 'Responds with a random dog image.',
clientPermissions: ['ATTACH_FILES']
@@ -6,7 +6,7 @@ module.exports = class FidgetCommand extends Command {
super(client, {
name: 'fidget',
aliases: ['nimbat'],
group: 'random-img',
group: 'random-res',
memberName: 'fidget',
description: 'Responds with a random image of Fidget.',
clientPermissions: ['ATTACH_FILES']
@@ -6,7 +6,7 @@ module.exports = class XiaoCommand extends Command {
super(client, {
name: 'xiao',
aliases: ['xiao-pai', 'iao'],
group: 'random-img',
group: 'random-res',
memberName: 'xiao',
description: 'Responds with a random image of Xiao Pai.',
clientPermissions: ['ATTACH_FILES']
@@ -8,7 +8,7 @@ module.exports = class NewYorkTimesCommand extends Command {
super(client, {
name: 'new-york-times',
aliases: ['ny-times', 'new-york-times-article', 'ny-times-article'],
group: 'random-res',
group: 'search',
memberName: 'new-york-times',
description: 'Responds with an article from the New York Times.',
clientPermissions: ['EMBED_LINKS'],
@@ -4,7 +4,7 @@ module.exports = class CanYouNotCommand extends Command {
constructor(client) {
super(client, {
name: 'can-you-not',
group: 'random',
group: 'single-res',
memberName: 'can-you-not',
description: 'Can YOU not?'
});
@@ -5,7 +5,7 @@ module.exports = class DarkThemeLightThemeCommand extends Command {
super(client, {
name: 'dark-theme-light-theme',
aliases: ['light-theme-dark-theme', 'dark-theme', 'light-theme'],
group: 'random',
group: 'single-res',
memberName: 'dark-theme-light-theme',
description: 'Determines whether you use dark or light theme.',
clientPermissions: ['ATTACH_FILES']
@@ -4,7 +4,7 @@ module.exports = class EatPantCommand extends Command {
constructor(client) {
super(client, {
name: 'eat-pant',
group: 'random',
group: 'single-res',
memberName: 'eat-pant',
description: 'eat pant',
clientPermissions: ['ATTACH_FILES']
@@ -4,7 +4,7 @@ module.exports = class GiveFlowerCommand extends Command {
constructor(client) {
super(client, {
name: 'give-flower',
group: 'random',
group: 'single-res',
memberName: 'give-flower',
description: 'Gives Xiao Pai a flower.'
});
@@ -4,7 +4,7 @@ module.exports = class ItsJokeCommand extends Command {
constructor(client) {
super(client, {
name: 'its-joke',
group: 'random',
group: 'single-res',
memberName: 'its-joke',
description: 'It\'s joke!',
clientPermissions: ['ATTACH_FILES']
@@ -4,7 +4,7 @@ module.exports = class LennyCommand extends Command {
constructor(client) {
super(client, {
name: 'lenny',
group: 'random',
group: 'single-res',
memberName: 'lenny',
description: 'Responds with the lenny face.'
});
@@ -4,7 +4,7 @@ module.exports = class SlowClapCommand extends Command {
constructor(client) {
super(client, {
name: 'slow-clap',
group: 'random',
group: 'single-res',
memberName: 'slow-clap',
description: '_slow clap_'
});
@@ -4,7 +4,7 @@ module.exports = class SpamCommand extends Command {
constructor(client) {
super(client, {
name: 'spam',
group: 'random',
group: 'single-res',
memberName: 'spam',
description: 'Responds with a picture of Spam.',
clientPermissions: ['ATTACH_FILES']
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "xiaobot",
"version": "45.0.0",
"version": "45.0.1",
"description": "Your personal server companion.",
"main": "Shard.js",
"scripts": {