From dd4e8196be5fe73835a0006886feb05ace690e32 Mon Sep 17 00:00:00 2001 From: WubzyGD Date: Fri, 26 Feb 2021 21:15:50 -0700 Subject: [PATCH] categorize cmds in file struct --- commands/{ => anime}/anime.js | 8 +- commands/{ => dev}/admin.js | 82 +++--- commands/{ => dev}/blacklist.js | 4 +- commands/{ => dev}/developer.js | 2 +- commands/{ => dev}/eval.js | 94 +++---- commands/{ => dev}/pull.js | 2 +- commands/{ => dev}/reload.js | 2 +- commands/{ => dev}/setstatus.js | 6 +- commands/{ => dev}/staff.js | 82 +++--- commands/{ => dev}/support.js | 82 +++--- commands/{ => dev}/vip.js | 106 ++++---- commands/{ => fun}/8ball.js | 68 ++--- commands/{ => fun}/deathnote.js | 286 ++++++++++---------- commands/{ => fun}/kiss.js | 6 +- commands/{ => fun}/secretsanta.js | 6 +- commands/{ => fun}/slap.js | 8 +- commands/{ => leveling}/levelchannel.js | 4 +- commands/{ => leveling}/levelrole.js | 6 +- commands/{ => leveling}/setupleveling.js | 2 +- commands/{ => leveling}/stats.js | 2 +- commands/{ => misc}/ar.js | 6 +- commands/{ => misc}/avatar.js | 62 ++--- commands/{ => misc}/help.js | 144 +++++----- commands/{ => misc}/info.js | 2 +- commands/{ => misc}/ingorear.js | 4 +- commands/{ => misc}/invite.js | 0 commands/{ => misc}/prefix.js | 4 +- commands/{ => misc}/supportserver.js | 0 commands/{ => misc}/userinfo.js | 2 +- commands/{ => moderation}/autorole.js | 2 +- commands/{ => moderation}/ban.js | 6 +- commands/{ => moderation}/clearwarnings.js | 2 +- commands/{ => moderation}/kick.js | 6 +- commands/{ => moderation}/leave.js | 6 +- commands/{ => moderation}/logs.js | 168 ++++++------ commands/{ => moderation}/response.js | 12 +- commands/{ => moderation}/softban.js | 4 +- commands/{ => moderation}/staffrole.js | 4 +- commands/{ => moderation}/togglestatuses.js | 52 ++-- commands/{ => moderation}/unban.js | 0 commands/{ => moderation}/warn.js | 6 +- commands/{ => moderation}/welcome.js | 6 +- commands/{ => social}/afk.js | 4 +- commands/{ => social}/bio.js | 2 +- commands/{ => social}/clearstatus.js | 4 +- commands/{ => social}/cry.js | 6 +- commands/{ => social}/dnd.js | 4 +- commands/{ => social}/hug.js | 8 +- commands/{ => social}/sip.js | 6 +- commands/{ => social}/starboard.js | 4 +- commands/{ => utility}/randnum.js | 0 handle/command.js | 7 +- handle/event.js | 2 +- handle/response.js | 2 +- util/cache.js | 2 +- 55 files changed, 704 insertions(+), 703 deletions(-) rename commands/{ => anime}/anime.js (96%) rename commands/{ => dev}/admin.js (97%) rename commands/{ => dev}/blacklist.js (98%) rename commands/{ => dev}/developer.js (98%) rename commands/{ => dev}/eval.js (94%) rename commands/{ => dev}/pull.js (97%) rename commands/{ => dev}/reload.js (98%) rename commands/{ => dev}/setstatus.js (93%) rename commands/{ => dev}/staff.js (97%) rename commands/{ => dev}/support.js (97%) rename commands/{ => dev}/vip.js (96%) rename commands/{ => fun}/8ball.js (98%) rename commands/{ => fun}/deathnote.js (96%) rename commands/{ => fun}/kiss.js (95%) rename commands/{ => fun}/secretsanta.js (98%) rename commands/{ => fun}/slap.js (94%) rename commands/{ => leveling}/levelchannel.js (96%) rename commands/{ => leveling}/levelrole.js (97%) rename commands/{ => leveling}/setupleveling.js (98%) rename commands/{ => leveling}/stats.js (97%) rename commands/{ => misc}/ar.js (98%) rename commands/{ => misc}/avatar.js (93%) rename commands/{ => misc}/help.js (96%) rename commands/{ => misc}/info.js (94%) rename commands/{ => misc}/ingorear.js (96%) rename commands/{ => misc}/invite.js (100%) rename commands/{ => misc}/prefix.js (96%) rename commands/{ => misc}/supportserver.js (100%) rename commands/{ => misc}/userinfo.js (98%) rename commands/{ => moderation}/autorole.js (97%) rename commands/{ => moderation}/ban.js (97%) rename commands/{ => moderation}/clearwarnings.js (98%) rename commands/{ => moderation}/kick.js (96%) rename commands/{ => moderation}/leave.js (96%) rename commands/{ => moderation}/logs.js (96%) rename commands/{ => moderation}/response.js (93%) rename commands/{ => moderation}/softban.js (98%) rename commands/{ => moderation}/staffrole.js (96%) rename commands/{ => moderation}/togglestatuses.js (95%) rename commands/{ => moderation}/unban.js (100%) rename commands/{ => moderation}/warn.js (98%) rename commands/{ => moderation}/welcome.js (96%) rename commands/{ => social}/afk.js (92%) rename commands/{ => social}/bio.js (98%) rename commands/{ => social}/clearstatus.js (88%) rename commands/{ => social}/cry.js (92%) rename commands/{ => social}/dnd.js (92%) rename commands/{ => social}/hug.js (94%) rename commands/{ => social}/sip.js (92%) rename commands/{ => social}/starboard.js (98%) rename commands/{ => utility}/randnum.js (100%) diff --git a/commands/anime.js b/commands/anime/anime.js similarity index 96% rename from commands/anime.js rename to commands/anime/anime.js index cb6bde8..0227d41 100644 --- a/commands/anime.js +++ b/commands/anime/anime.js @@ -1,9 +1,9 @@ -const {TagFilter} = require("../util/tagfilter"); -const {Tag} = require ("../util/tag"); +const {TagFilter} = require("../../util/tagfilter"); +const {Tag} = require ("../../util/tag"); const Discord = require('discord.js'); -const UserData = require('../models/user'); -const AniData = require('../models/anime'); +const UserData = require('../../models/user'); +const AniData = require('../../models/anime'); module.exports = { name: "anime", diff --git a/commands/admin.js b/commands/dev/admin.js similarity index 97% rename from commands/admin.js rename to commands/dev/admin.js index 6934843..bed5272 100644 --- a/commands/admin.js +++ b/commands/dev/admin.js @@ -1,42 +1,42 @@ -const Discord = require('discord.js'); -const UserData = require('../models/user'); - -module.exports = { - name: "admin", - help: new Discord.MessageEmbed() - .setTitle("Help -> Admin") - .setDescription("Make a user a Natsuki admin") - .addField("Syntax", "`admin <@user|userID>`") - .addField("Notice", "This command is only available to Natsuki developers."), - meta: { - category: 'Developer', - description: "Add or remove users as Natsuki admins", - syntax: '`admin <@user|userID>`', - extra: "You can check if a user is an admin without being a developer." - }, - async execute(message, msg, args, cmd, prefix, mention, client) { - if (!message.guild) {return message.reply("This is a guild-only command.");} - if (!args.length) {return message.channel.send(`Syntax: \`${prefix}\``);} - let person = mention ? mention : args[1] ? client.users.cache.has(args[1]) ? client.users.cache.get(args[1]) : null : null; - let tu = await UserData.findOne({uid: person ? person.id : message.author.id}) ? await UserData.findOne({uid: person ? person.id : message.author.id}) : new UserData({uid: person ? person.id : message.author.id}); - if (['c', 'check'].includes(args[0])) {return message.reply(`${person ? person : message.member.displayName} ${tu.admin ? 'is' : 'is not'} a Natsuki Admin.`);} - if (!['a', 'add', 'r', 'remove'].includes(args[0])) {return message.reply("You must specify whether to `add` or `remove` someone as an admin.");} - if (!person) {return message.reply("You must mention someone to add as an admin, or use their ID.");} - let atu = await UserData.findOne({uid: message.author.id}); - if (!atu && !atu.developer && !client.developers.includes(message.author.id)) {return message.reply('You must be a developer in order to add set admin statuses.');} - if (['a', 'add'].includes(args[0])) {tu.support = true; tu.staff = true; tu.admin = true;} - else {tu.admin = false; tu.developer = false;} - tu.save(); - const logemb = (act) => new Discord.MessageEmbed() - .setAuthor(`Admin ${act}`, message.author.avatarURL()) - .setDescription("A user's Admin status was updated.") - .setThumbnail(person.avatarURL({size: 1024})) - .addField("Name", person.username, true) - .addField("Developer", message.author.username, true) - .setColor("e8da3a") - .setFooter("Natsuki") - .setTimestamp(); - client.guilds.cache.get('762707532417335296').channels.cache.get('762732961753595915').send(logemb(['a', 'add'].includes(args[0]) ? 'Added' : 'Removed')); - return message.reply(`${message.guild.members.cache.get(person.id).displayName} is no${['a', 'add'].includes(args[0]) ? 'w' : ' longer'} an admin!`); - } +const Discord = require('discord.js'); +const UserData = require('../../models/user'); + +module.exports = { + name: "admin", + help: new Discord.MessageEmbed() + .setTitle("Help -> Admin") + .setDescription("Make a user a Natsuki admin") + .addField("Syntax", "`admin <@user|userID>`") + .addField("Notice", "This command is only available to Natsuki developers."), + meta: { + category: 'Developer', + description: "Add or remove users as Natsuki admins", + syntax: '`admin <@user|userID>`', + extra: "You can check if a user is an admin without being a developer." + }, + async execute(message, msg, args, cmd, prefix, mention, client) { + if (!message.guild) {return message.reply("This is a guild-only command.");} + if (!args.length) {return message.channel.send(`Syntax: \`${prefix}\``);} + let person = mention ? mention : args[1] ? client.users.cache.has(args[1]) ? client.users.cache.get(args[1]) : null : null; + let tu = await UserData.findOne({uid: person ? person.id : message.author.id}) ? await UserData.findOne({uid: person ? person.id : message.author.id}) : new UserData({uid: person ? person.id : message.author.id}); + if (['c', 'check'].includes(args[0])) {return message.reply(`${person ? person : message.member.displayName} ${tu.admin ? 'is' : 'is not'} a Natsuki Admin.`);} + if (!['a', 'add', 'r', 'remove'].includes(args[0])) {return message.reply("You must specify whether to `add` or `remove` someone as an admin.");} + if (!person) {return message.reply("You must mention someone to add as an admin, or use their ID.");} + let atu = await UserData.findOne({uid: message.author.id}); + if (!atu && !atu.developer && !client.developers.includes(message.author.id)) {return message.reply('You must be a developer in order to add set admin statuses.');} + if (['a', 'add'].includes(args[0])) {tu.support = true; tu.staff = true; tu.admin = true;} + else {tu.admin = false; tu.developer = false;} + tu.save(); + const logemb = (act) => new Discord.MessageEmbed() + .setAuthor(`Admin ${act}`, message.author.avatarURL()) + .setDescription("A user's Admin status was updated.") + .setThumbnail(person.avatarURL({size: 1024})) + .addField("Name", person.username, true) + .addField("Developer", message.author.username, true) + .setColor("e8da3a") + .setFooter("Natsuki") + .setTimestamp(); + client.guilds.cache.get('762707532417335296').channels.cache.get('762732961753595915').send(logemb(['a', 'add'].includes(args[0]) ? 'Added' : 'Removed')); + return message.reply(`${message.guild.members.cache.get(person.id).displayName} is no${['a', 'add'].includes(args[0]) ? 'w' : ' longer'} an admin!`); + } }; \ No newline at end of file diff --git a/commands/blacklist.js b/commands/dev/blacklist.js similarity index 98% rename from commands/blacklist.js rename to commands/dev/blacklist.js index 5909f24..e0138d1 100644 --- a/commands/blacklist.js +++ b/commands/dev/blacklist.js @@ -1,6 +1,6 @@ const Discord = require('discord.js'); -const UserData = require('../models/user'); -const GuildData = require('../models/guild') +const UserData = require('../../models/user'); +const GuildData = require('../../models/guild') module.exports = { name: "blacklist", diff --git a/commands/developer.js b/commands/dev/developer.js similarity index 98% rename from commands/developer.js rename to commands/dev/developer.js index 61d85fb..1433e07 100644 --- a/commands/developer.js +++ b/commands/dev/developer.js @@ -1,6 +1,6 @@ const Discord = require('discord.js'); const mongoose = require('mongoose'); -const UserData = require('../models/user'); +const UserData = require('../../models/user'); module.exports = { name: "developer", diff --git a/commands/eval.js b/commands/dev/eval.js similarity index 94% rename from commands/eval.js rename to commands/dev/eval.js index 03ab1c5..e269672 100644 --- a/commands/eval.js +++ b/commands/dev/eval.js @@ -1,48 +1,48 @@ -const Discord = require('discord.js'); -const chalk = require('chalk'); - -const {Tag} = require('../util/tag'); -const {TagFilter} = require('../util/tagfilter'); - -module.exports = { - name: 'eval', - aliases: ['ev', ':', 'e'], - help: "Evaluates raw JavaScript code. *This is a __developer-only__ command.* Usage: `{{p}}eval `", - meta: { - category: 'Developer', - description: "Evaluates raw JavaScript code. Nerd access only.", - syntax: '`eval `', - extra: null - }, - execute(message, msg, args, cmd, prefix, mention, client) { - try { - if (!client.developers.includes(message.author.id)) {return message.channel.send("Sorry, but I've got trust issues, so only me devs can go commanding me around like that.");}; - if (!args.length) return message.channel.send(`Syntax: \`${prefix}eval \``); - - let options = new TagFilter([new Tag(['s', 'silent', 'nr', 'noreply'], 'silent', 'toggle')]).test(args[0]); - if (options.silent) {args.shift();} - - if (!args.length) {return message.channel.send("Silly goose, if you want me to do something, you have to tell me what!");} - const result = new Promise((resolve) => resolve(eval(args.join(' ')))); - return result.then((output) => { - if (typeof output !== 'string') { - output = require('util').inspect(output, {depth: 0}); - } - output = output.replace(client.config.token, 'Client Token') - .replace(client.config.database.password, 'Database Password') - .replace(client.config.database.cluster, 'Database Cluster'); - - return options.silent ? null : message.channel.send(new Discord.MessageEmbed() - .setTitle('Client Evaluation') - .setDescription(`\`\`\`js\n${output}\n\`\`\``) - .setColor('c375f0') - .setFooter(`Natsuki`, client.user.avatarURL()) - .setTimestamp()); - }).catch(error => {return message.channel.send(`Error: \`${error}\`.`);}); - } catch (error) { - let date = new Date; date = date.toString().slice(date.toString().search(":") - 2, date.toString().search(":") + 6); - console.error(`\n${chalk.red('[ERROR]')} >> ${chalk.yellow(`At [${date}] | Occurred while trying to run n?eval`)}`, error); - return message.channel.send(`Error: \`${error}\`.`); - } - }, +const Discord = require('discord.js'); +const chalk = require('chalk'); + +const {Tag} = require('../../util/tag'); +const {TagFilter} = require('../../util/tagfilter'); + +module.exports = { + name: 'eval', + aliases: ['ev', ':', 'e'], + help: "Evaluates raw JavaScript code. *This is a __developer-only__ command.* Usage: `{{p}}eval `", + meta: { + category: 'Developer', + description: "Evaluates raw JavaScript code. Nerd access only.", + syntax: '`eval `', + extra: null + }, + execute(message, msg, args, cmd, prefix, mention, client) { + try { + if (!client.developers.includes(message.author.id)) {return message.channel.send("Sorry, but I've got trust issues, so only me devs can go commanding me around like that.");}; + if (!args.length) return message.channel.send(`Syntax: \`${prefix}eval \``); + + let options = new TagFilter([new Tag(['s', 'silent', 'nr', 'noreply'], 'silent', 'toggle')]).test(args[0]); + if (options.silent) {args.shift();} + + if (!args.length) {return message.channel.send("Silly goose, if you want me to do something, you have to tell me what!");} + const result = new Promise((resolve) => resolve(eval(args.join(' ')))); + return result.then((output) => { + if (typeof output !== 'string') { + output = require('util').inspect(output, {depth: 0}); + } + output = output.replace(client.config.token, 'Client Token') + .replace(client.config.database.password, 'Database Password') + .replace(client.config.database.cluster, 'Database Cluster'); + + return options.silent ? null : message.channel.send(new Discord.MessageEmbed() + .setTitle('Client Evaluation') + .setDescription(`\`\`\`js\n${output}\n\`\`\``) + .setColor('c375f0') + .setFooter(`Natsuki`, client.user.avatarURL()) + .setTimestamp()); + }).catch(error => {return message.channel.send(`Error: \`${error}\`.`);}); + } catch (error) { + let date = new Date; date = date.toString().slice(date.toString().search(":") - 2, date.toString().search(":") + 6); + console.error(`\n${chalk.red('[ERROR]')} >> ${chalk.yellow(`At [${date}] | Occurred while trying to run n?eval`)}`, error); + return message.channel.send(`Error: \`${error}\`.`); + } + }, }; \ No newline at end of file diff --git a/commands/pull.js b/commands/dev/pull.js similarity index 97% rename from commands/pull.js rename to commands/dev/pull.js index 401b22b..30c39a3 100644 --- a/commands/pull.js +++ b/commands/dev/pull.js @@ -1,7 +1,7 @@ const Discord = require('discord.js'); const fs = require('fs'); const chalk = require('chalk'); -const UserData = require('../models/user'); +const UserData = require('../../models/user'); const cp = require('child_process'); module.exports = { diff --git a/commands/reload.js b/commands/dev/reload.js similarity index 98% rename from commands/reload.js rename to commands/dev/reload.js index bb0f3a5..b6c23fb 100644 --- a/commands/reload.js +++ b/commands/dev/reload.js @@ -3,7 +3,7 @@ const fs = require('fs'); const chalk = require('chalk'); const ora = require('ora'); -const UserData = require("../models/user"); +const UserData = require("../../models/user"); module.exports = { name: "reload", diff --git a/commands/setstatus.js b/commands/dev/setstatus.js similarity index 93% rename from commands/setstatus.js rename to commands/dev/setstatus.js index d143653..ecbab5f 100644 --- a/commands/setstatus.js +++ b/commands/dev/setstatus.js @@ -1,9 +1,9 @@ const Discord = require('discord.js'); -const UserData = require('../models/user'); +const UserData = require('../../models/user'); -const {TagFilter} = require('../util/tagfilter'); -const {Tag} = require('../util/tag'); +const {TagFilter} = require('../../util/tagfilter'); +const {Tag} = require('../../util/tag'); module.exports = { name: "setstatus", diff --git a/commands/staff.js b/commands/dev/staff.js similarity index 97% rename from commands/staff.js rename to commands/dev/staff.js index e14c06e..4fd864a 100644 --- a/commands/staff.js +++ b/commands/dev/staff.js @@ -1,42 +1,42 @@ -const Discord = require('discord.js'); -const UserData = require('../models/user'); - -module.exports = { - name: "staff", - help: new Discord.MessageEmbed() - .setTitle("Help -> Staff") - .setDescription("Make a user a Natsuki staff member") - .addField("Syntax", "`staff <@user|userID>`") - .addField("Notice", "This command is only available to Natsuki developers."), - meta: { - category: 'Developer', - description: "Add or remove users as Natsuki staff", - syntax: '`staff <@user|userID>`', - extra: "You can check if a user is staff without being a developer." - }, - async execute(message, msg, args, cmd, prefix, mention, client) { - if (!message.guild) {return message.reply("This is a guild-only command.");} - if (!args.length) {return message.channel.send(`Syntax: \`${prefix}\``);} - let person = mention ? mention : args[1] ? client.users.cache.has(args[1]) ? client.users.cache.get(args[1]) : null : null; - let tu = await UserData.findOne({uid: person ? person.id : message.author.id}) ? await UserData.findOne({uid: person ? person.id : message.author.id}) : new UserData({uid: person ? person.id : message.author.id}); - if (['c', 'check'].includes(args[0])) {return message.reply(`${person ? person : message.member.displayName} ${tu.staff ? 'is' : 'is not'} a part of Natsuki Staff.`);} - if (!['a', 'add', 'r', 'remove'].includes(args[0])) {return message.reply("You must specify whether to `add` or `remove` someone as a Staff Member.");} - if (!person) {return message.reply("You must mention someone to add as a staff member, or use their ID.");} - let atu = await UserData.findOne({uid: message.author.id}); - if (!atu && !atu.developer && !client.developers.includes(message.author.id)) {return message.reply('You must be a developer in order to add set staff member statuses.');} - if (['a', 'add'].includes(args[0])) {tu.support = true; tu.staff = true;} - else {tu.staff = false; tu.admin = false; tu.developer = false;} - tu.save(); - const logemb = (act) => new Discord.MessageEmbed() - .setAuthor(`Staff ${act}`, message.author.avatarURL()) - .setDescription("A user's Staff status was updated.") - .setThumbnail(person.avatarURL({size: 1024})) - .addField("Name", person.username, true) - .addField("Developer", message.author.username, true) - .setColor("e8da3a") - .setFooter("Natsuki") - .setTimestamp(); - client.guilds.cache.get('762707532417335296').channels.cache.get('762732961753595915').send(logemb(['a', 'add'].includes(args[0]) ? 'Added' : 'Removed')); - return message.reply(`${message.guild.members.cache.get(person.id).displayName} is no${['a', 'add'].includes(args[0]) ? 'w' : ' longer'} a staff member!`); - } +const Discord = require('discord.js'); +const UserData = require('../../models/user'); + +module.exports = { + name: "staff", + help: new Discord.MessageEmbed() + .setTitle("Help -> Staff") + .setDescription("Make a user a Natsuki staff member") + .addField("Syntax", "`staff <@user|userID>`") + .addField("Notice", "This command is only available to Natsuki developers."), + meta: { + category: 'Developer', + description: "Add or remove users as Natsuki staff", + syntax: '`staff <@user|userID>`', + extra: "You can check if a user is staff without being a developer." + }, + async execute(message, msg, args, cmd, prefix, mention, client) { + if (!message.guild) {return message.reply("This is a guild-only command.");} + if (!args.length) {return message.channel.send(`Syntax: \`${prefix}\``);} + let person = mention ? mention : args[1] ? client.users.cache.has(args[1]) ? client.users.cache.get(args[1]) : null : null; + let tu = await UserData.findOne({uid: person ? person.id : message.author.id}) ? await UserData.findOne({uid: person ? person.id : message.author.id}) : new UserData({uid: person ? person.id : message.author.id}); + if (['c', 'check'].includes(args[0])) {return message.reply(`${person ? person : message.member.displayName} ${tu.staff ? 'is' : 'is not'} a part of Natsuki Staff.`);} + if (!['a', 'add', 'r', 'remove'].includes(args[0])) {return message.reply("You must specify whether to `add` or `remove` someone as a Staff Member.");} + if (!person) {return message.reply("You must mention someone to add as a staff member, or use their ID.");} + let atu = await UserData.findOne({uid: message.author.id}); + if (!atu && !atu.developer && !client.developers.includes(message.author.id)) {return message.reply('You must be a developer in order to add set staff member statuses.');} + if (['a', 'add'].includes(args[0])) {tu.support = true; tu.staff = true;} + else {tu.staff = false; tu.admin = false; tu.developer = false;} + tu.save(); + const logemb = (act) => new Discord.MessageEmbed() + .setAuthor(`Staff ${act}`, message.author.avatarURL()) + .setDescription("A user's Staff status was updated.") + .setThumbnail(person.avatarURL({size: 1024})) + .addField("Name", person.username, true) + .addField("Developer", message.author.username, true) + .setColor("e8da3a") + .setFooter("Natsuki") + .setTimestamp(); + client.guilds.cache.get('762707532417335296').channels.cache.get('762732961753595915').send(logemb(['a', 'add'].includes(args[0]) ? 'Added' : 'Removed')); + return message.reply(`${message.guild.members.cache.get(person.id).displayName} is no${['a', 'add'].includes(args[0]) ? 'w' : ' longer'} a staff member!`); + } }; \ No newline at end of file diff --git a/commands/support.js b/commands/dev/support.js similarity index 97% rename from commands/support.js rename to commands/dev/support.js index 16b7863..b851228 100644 --- a/commands/support.js +++ b/commands/dev/support.js @@ -1,42 +1,42 @@ -const Discord = require('discord.js'); -const UserData = require('../models/user'); - -module.exports = { - name: "support", - help: new Discord.MessageEmbed() - .setTitle("Help -> Support") - .setDescription("Make a user a Natsuki Support Team member") - .addField("Syntax", "`support <@user|userID>`") - .addField("Notice", "This command is only available to Natsuki admin."), - meta: { - category: 'Developer', - description: "Add or remove users as Natsuki support", - syntax: '`support <@user|userID>`', - extra: "You can check if a user is a support member without being a developer." - }, - async execute(message, msg, args, cmd, prefix, mention, client) { - if (!message.guild) {return message.reply("This is a guild-only command.");} - if (!args.length) {return message.channel.send(`Syntax: \`${prefix}\``);} - let person = mention ? mention : args[1] ? client.users.cache.has(args[1]) ? client.users.cache.get(args[1]) : null : null; - let tu = await UserData.findOne({uid: person ? person.id : message.author.id}) ? await UserData.findOne({uid: person ? person.id : message.author.id}) : new UserData({uid: person ? person.id : message.author.id}); - if (['c', 'check'].includes(args[0])) {return message.reply(`${person ? person : message.member.displayName} ${tu.support ? 'is' : 'is not'} a part of Natsuki Support.`);} - if (!['a', 'add', 'r', 'remove'].includes(args[0])) {return message.reply("You must specify whether to `add` or `remove` someone as a Support Team Member.");} - if (!person) {return message.reply("You must mention someone to add as a support member, or use their ID.");} - let atu = await UserData.findOne({uid: message.author.id}); - if (!atu && !atu.admin) {return message.reply('You must be an admin in order to add set support team member statuses.');} - if (['a', 'add'].includes(args[0])) {tu.support = true;} - else {tu.support = false; tu.staff = false; tu.admin = false; tu.developer = false;} - tu.save(); - const logemb = (act) => new Discord.MessageEmbed() - .setAuthor(`Support ${act}`, message.author.avatarURL()) - .setDescription("A user's Support status was updated.") - .setThumbnail(person.avatarURL({size: 1024})) - .addField("Name", person.username, true) - .addField("Developer", message.author.username, true) - .setColor("e8da3a") - .setFooter("Natsuki") - .setTimestamp(); - client.guilds.cache.get('762707532417335296').channels.cache.get('762732961753595915').send(logemb(['a', 'add'].includes(args[0]) ? 'Added' : 'Removed')); - return message.reply(`${message.guild.members.cache.get(person.id).displayName} is no${['a', 'add'].includes(args[0]) ? 'w' : ' longer'} a Support Team member!`); - } +const Discord = require('discord.js'); +const UserData = require('../../models/user'); + +module.exports = { + name: "support", + help: new Discord.MessageEmbed() + .setTitle("Help -> Support") + .setDescription("Make a user a Natsuki Support Team member") + .addField("Syntax", "`support <@user|userID>`") + .addField("Notice", "This command is only available to Natsuki admin."), + meta: { + category: 'Developer', + description: "Add or remove users as Natsuki support", + syntax: '`support <@user|userID>`', + extra: "You can check if a user is a support member without being a developer." + }, + async execute(message, msg, args, cmd, prefix, mention, client) { + if (!message.guild) {return message.reply("This is a guild-only command.");} + if (!args.length) {return message.channel.send(`Syntax: \`${prefix}\``);} + let person = mention ? mention : args[1] ? client.users.cache.has(args[1]) ? client.users.cache.get(args[1]) : null : null; + let tu = await UserData.findOne({uid: person ? person.id : message.author.id}) ? await UserData.findOne({uid: person ? person.id : message.author.id}) : new UserData({uid: person ? person.id : message.author.id}); + if (['c', 'check'].includes(args[0])) {return message.reply(`${person ? person : message.member.displayName} ${tu.support ? 'is' : 'is not'} a part of Natsuki Support.`);} + if (!['a', 'add', 'r', 'remove'].includes(args[0])) {return message.reply("You must specify whether to `add` or `remove` someone as a Support Team Member.");} + if (!person) {return message.reply("You must mention someone to add as a support member, or use their ID.");} + let atu = await UserData.findOne({uid: message.author.id}); + if (!atu && !atu.admin) {return message.reply('You must be an admin in order to add set support team member statuses.');} + if (['a', 'add'].includes(args[0])) {tu.support = true;} + else {tu.support = false; tu.staff = false; tu.admin = false; tu.developer = false;} + tu.save(); + const logemb = (act) => new Discord.MessageEmbed() + .setAuthor(`Support ${act}`, message.author.avatarURL()) + .setDescription("A user's Support status was updated.") + .setThumbnail(person.avatarURL({size: 1024})) + .addField("Name", person.username, true) + .addField("Developer", message.author.username, true) + .setColor("e8da3a") + .setFooter("Natsuki") + .setTimestamp(); + client.guilds.cache.get('762707532417335296').channels.cache.get('762732961753595915').send(logemb(['a', 'add'].includes(args[0]) ? 'Added' : 'Removed')); + return message.reply(`${message.guild.members.cache.get(person.id).displayName} is no${['a', 'add'].includes(args[0]) ? 'w' : ' longer'} a Support Team member!`); + } }; \ No newline at end of file diff --git a/commands/vip.js b/commands/dev/vip.js similarity index 96% rename from commands/vip.js rename to commands/dev/vip.js index b594d78..e43dfcf 100644 --- a/commands/vip.js +++ b/commands/dev/vip.js @@ -1,54 +1,54 @@ -const Discord = require("discord.js"); - -module.exports = { - name: "vip", - aliases: ["premium"], - help: new Discord.MessageEmbed() - .setTitle("Help -> VIP") - .setDescription("Toggle a server as VIP. This grants a few small bonuses to your server that you can't get anywhere else!\n\nWant to become a VIP? Support the bot by [joining the support server](), donating to the bot's creators, or promoting/spreading the bot to other servers.") - .addField("Syntax", "`vip `") - .addField("Notice", "This command is **developer-only**."), - meta: { - category: 'Developer', - description: "Set server VIP status", - syntax: '`vip `', - extra: "This command is mostly cosmetic as there are no real perks *yet*" - }, - async execute(message, msg, args, cmd, prefix, mention, client) { - if (!message.guild) {return message.reply("This command is server-only!");} - if (!args.length) {return message.channel.send(`Syntax: \`${prefix}vip \``);} - if (!client.developers.includes(message.author.id) && !['check', 'c', 'view', 'v'].includes(args[0])) {return message.reply("Unfortunately, this is a **developer-only command**!");} - const GuildSettings = require('../models/guild'); - const logemb = (act) => new Discord.MessageEmbed() - .setAuthor(`VIP Server ${act}`, message.author.avatarURL()) - .setDescription("A Server's VIP status was updated.") - .setThumbnail(message.guild.iconURL({size: 1024})) - .addField("Name", message.guild.name, true) - .addField("Admin", message.author.username, true) - .setColor("e8da3a") - .setFooter("Natsuki") - .setTimestamp(); - - if (['add', 'a', 'make', 'm'].includes(args[0])) { - let tguild = await GuildSettings.findOne({gid: message.guild.id}) - ? await GuildSettings.findOne({gid: message.guild.id}) - : new GuildSettings({gid: message.guild.id}); - if (tguild.vip === true) {return message.reply("This server is already a VIP server.");} - tguild.vip = true; - tguild.save(); - client.guilds.cache.get('762707532417335296').channels.cache.get('762732961753595915').send(logemb("Added")); - return message.reply("This server is now a VIP server!"); - } else if (['remove', 'r', 'delete', 'd'].includes(args[0])) { - let tguild = await GuildSettings.findOne({gid: message.guild.id}); - if (tguild) { - if (tguild.vip === false) {return message.reply("This server wasn't a VIP server anyways...");} - await GuildSettings.findOneAndUpdate({gid: message.guild.id, vip: false}); - client.guilds.cache.get('762707532417335296').channels.cache.get('762732961753595915').send(logemb("Removed")); - } else {return message.reply("This server wasn't a VIP server anyways...");} - return message.reply("This server is no longer a VIP server!"); - } else if (['check', 'c', 'view', 'v'].includes(args[0])) { - let tguild = await GuildSettings.findOne({gid: message.guild.id}); - return message.reply((tguild && tguild.vip) ? 'This server is a VIP server.' : 'This server is not a VIP server.'); - } - } +const Discord = require("discord.js"); + +module.exports = { + name: "vip", + aliases: ["premium"], + help: new Discord.MessageEmbed() + .setTitle("Help -> VIP") + .setDescription("Toggle a server as VIP. This grants a few small bonuses to your server that you can't get anywhere else!\n\nWant to become a VIP? Support the bot by [joining the support server](), donating to the bot's creators, or promoting/spreading the bot to other servers.") + .addField("Syntax", "`vip `") + .addField("Notice", "This command is **developer-only**."), + meta: { + category: 'Developer', + description: "Set server VIP status", + syntax: '`vip `', + extra: "This command is mostly cosmetic as there are no real perks *yet*" + }, + async execute(message, msg, args, cmd, prefix, mention, client) { + if (!message.guild) {return message.reply("This command is server-only!");} + if (!args.length) {return message.channel.send(`Syntax: \`${prefix}vip \``);} + if (!client.developers.includes(message.author.id) && !['check', 'c', 'view', 'v'].includes(args[0])) {return message.reply("Unfortunately, this is a **developer-only command**!");} + const GuildSettings = require('../../models/guild'); + const logemb = (act) => new Discord.MessageEmbed() + .setAuthor(`VIP Server ${act}`, message.author.avatarURL()) + .setDescription("A Server's VIP status was updated.") + .setThumbnail(message.guild.iconURL({size: 1024})) + .addField("Name", message.guild.name, true) + .addField("Admin", message.author.username, true) + .setColor("e8da3a") + .setFooter("Natsuki") + .setTimestamp(); + + if (['add', 'a', 'make', 'm'].includes(args[0])) { + let tguild = await GuildSettings.findOne({gid: message.guild.id}) + ? await GuildSettings.findOne({gid: message.guild.id}) + : new GuildSettings({gid: message.guild.id}); + if (tguild.vip === true) {return message.reply("This server is already a VIP server.");} + tguild.vip = true; + tguild.save(); + client.guilds.cache.get('762707532417335296').channels.cache.get('762732961753595915').send(logemb("Added")); + return message.reply("This server is now a VIP server!"); + } else if (['remove', 'r', 'delete', 'd'].includes(args[0])) { + let tguild = await GuildSettings.findOne({gid: message.guild.id}); + if (tguild) { + if (tguild.vip === false) {return message.reply("This server wasn't a VIP server anyways...");} + await GuildSettings.findOneAndUpdate({gid: message.guild.id, vip: false}); + client.guilds.cache.get('762707532417335296').channels.cache.get('762732961753595915').send(logemb("Removed")); + } else {return message.reply("This server wasn't a VIP server anyways...");} + return message.reply("This server is no longer a VIP server!"); + } else if (['check', 'c', 'view', 'v'].includes(args[0])) { + let tguild = await GuildSettings.findOne({gid: message.guild.id}); + return message.reply((tguild && tguild.vip) ? 'This server is a VIP server.' : 'This server is not a VIP server.'); + } + } }; \ No newline at end of file diff --git a/commands/8ball.js b/commands/fun/8ball.js similarity index 98% rename from commands/8ball.js rename to commands/fun/8ball.js index 8a6920c..532f76d 100644 --- a/commands/8ball.js +++ b/commands/fun/8ball.js @@ -1,35 +1,35 @@ -const Discord = require("discord.js"); - -module.exports = { - name: "8ball", - aliases: ["8b"], - help: new Discord.MessageEmbed() - .setTitle("Help -> 8ball") - .setDescription("Gives you moral support, decides if you really do want that third taco, or helps you decide on your existential crisis. Answers come with an accuracy guarantee of 0%!") - .addField("Syntax", "`8ball `"), - meta: { - category: 'Fun', - description: "Gives you moral support, decides if you really do want that third taco, or helps you decide on your existential crisis. Answers come with an accuracy guarantee of 0%!", - syntax: '`8ball `', - extra: null - }, - execute(message, msg, args, cmd, prefix, mention, client) { - if (!args.length) {return message.channel.send(`Syntax: \`${prefix}8ball \``);} - let question = args.join(" "); - if (question.length > 230) {return message.reply("Listen, I'm no fortune-teller. I can't help you with a question that long!");} - - let responses = [ - /*Positive Responses*/ "Yes!", "I think so", "Possibly", "Certainly", "Definitely", "Absolutely", "Sure!", "Most Likely", "I believe so", "If you're asking for my honest opinion... yes" - /*Negative Responses*/ ,"No!", "I don't think so", "Probably not", "Impossible", "Nope", "Absolutely *not*", "Nah", "Doubt it", "I don't believe so", "If you're asking for my honest opinion... no" - /*Neutral Responses */ ,"Maybe", "I'm not sure", "I'll think about it", "Uhh Natsuki isn't here right now. I can take a message?", "I'm sure if you look deep within your heart, which is currently all over that tree, you'll find the answer", "I mean, if you think so...", "I don't have an opinion on that.", "I'll choose to remain silent." - ]; - let name = message.guild ? message.member.displayName : message.author.username; - - return message.reply(new Discord.MessageEmbed() - .setAuthor("8ball Question", message.author.avatarURL()) - .setDescription("**Question:** " + question + "\n**Answer:** " + responses[Math.floor(Math.random() * responses.length)]) - .setColor("c375f0") - .setFooter(`Asked by ${name} | Natsuki`) - .setTimestamp()); - } +const Discord = require("discord.js"); + +module.exports = { + name: "8ball", + aliases: ["8b"], + help: new Discord.MessageEmbed() + .setTitle("Help -> 8ball") + .setDescription("Gives you moral support, decides if you really do want that third taco, or helps you decide on your existential crisis. Answers come with an accuracy guarantee of 0%!") + .addField("Syntax", "`8ball `"), + meta: { + category: 'Fun', + description: "Gives you moral support, decides if you really do want that third taco, or helps you decide on your existential crisis. Answers come with an accuracy guarantee of 0%!", + syntax: '`8ball `', + extra: null + }, + execute(message, msg, args, cmd, prefix, mention, client) { + if (!args.length) {return message.channel.send(`Syntax: \`${prefix}8ball \``);} + let question = args.join(" "); + if (question.length > 230) {return message.reply("Listen, I'm no fortune-teller. I can't help you with a question that long!");} + + let responses = [ + /*Positive Responses*/ "Yes!", "I think so", "Possibly", "Certainly", "Definitely", "Absolutely", "Sure!", "Most Likely", "I believe so", "If you're asking for my honest opinion... yes" + /*Negative Responses*/ ,"No!", "I don't think so", "Probably not", "Impossible", "Nope", "Absolutely *not*", "Nah", "Doubt it", "I don't believe so", "If you're asking for my honest opinion... no" + /*Neutral Responses */ ,"Maybe", "I'm not sure", "I'll think about it", "Uhh Natsuki isn't here right now. I can take a message?", "I'm sure if you look deep within your heart, which is currently all over that tree, you'll find the answer", "I mean, if you think so...", "I don't have an opinion on that.", "I'll choose to remain silent." + ]; + let name = message.guild ? message.member.displayName : message.author.username; + + return message.reply(new Discord.MessageEmbed() + .setAuthor("8ball Question", message.author.avatarURL()) + .setDescription("**Question:** " + question + "\n**Answer:** " + responses[Math.floor(Math.random() * responses.length)]) + .setColor("c375f0") + .setFooter(`Asked by ${name} | Natsuki`) + .setTimestamp()); + } }; \ No newline at end of file diff --git a/commands/deathnote.js b/commands/fun/deathnote.js similarity index 96% rename from commands/deathnote.js rename to commands/fun/deathnote.js index 236e162..6c4eb05 100644 --- a/commands/deathnote.js +++ b/commands/fun/deathnote.js @@ -1,144 +1,144 @@ -const Discord = require('discord.js'); -const moment = require('moment'); - -const VC = require('../models/vscount'); - -const {Tag} = require('../util/tag'); -const {TagFilter} = require('../util/tagfilter'); - -const deaths = [ - "watching too much anime", "an overdose of waifus", "Hypotakunemia", "trying to self-isekai", - "Bass:tm:", "cranking the music just a little too loud", "trying to swim in lava", "an unknown cause", - "Despacito", "something really cliche and unoriginal", "'shrooms", - "clicking 'I agree' without reading the Terms of Service", "alchemy", "rusty spoons", - "picking the wrong waifu", "body pillows", "fur-con", "something to do with lamb sauce", - "grandma's cookies" -]; // a list of preset death methods that can occur - -const before = [ - "A name is being written...", "Someone will perish soon...", "A body is *about* to be discovered...", - "{p} is scribbling something in their notebook...", "\*Manical laughter echoes around you*...", - "{p} laughs maniacally..." -]; // things it says before the response is sent - -const responses = { - /*an obj controlling the possible formats for the death note report*/ - news: { - titles: ["Breaking News"], - texts: [ - "This just in: **{p}** was found dead at **{ds}** today.\n\nAfter some investigation, the authorities ruled the cause of death to be **{c}**.", - "We're now live at the crime scene where it is believed that **{p}** died because of **{c}**.", - "Authorities are reporting what is believed to be another Kira case, where **{c}** has taken the life of **{p}**." - ], - images: [], - }, // a news report of the dead body - writes: { - titles: ["Something sinister just happened", "A name has been written", "Fate has been changed"], - texts: [ - "With a maniacal laugh, **{w}** writes \"**{p}**\" in their Death Note. And the cause of death? They've written **{c}**.", - "**{w}** has sealed **{pa}** fate to die by **{c}**." - ], - images: [] - }, // "so-and-so writes blah blah blah's name in their death note" - /*hasdied: { - texts: [], - images: [] - }, // "so-and-so has died by...", - unserious: { - texts: [], - images: [] - } // other methods, mainly the un-serious or joking ones */ -}; - -//responses.unserious.images = responses.hasdied.images; - -module.exports = { - name: "deathnote", - aliases: ['dn'], - help: new Discord.MessageEmbed() - .setTitle("Help -> Death Note") - .setDescription("Congratulations! You've picked up a death note. Write someone's name in it, and see for yourself if it's the real deal...") - .addField("Syntax", "\`deathnote <@member> [method of death]\`"), - meta: { - category: 'Fun', - description: "Write someone's name in your deathnote. I'm not legally responsible for anything that happens after that.", - syntax: '`deathnote <@member> [method of death]`', - extra: null - }, - async execute(message, msg, args, cmd, prefix, mention, client) { - if (!message.guild) {return message.reply("Unfortunately, this is a **guild-only** command!");} - if (!args.length) {return message.channel.send(`Syntax: \`${prefix}deathnote <@member> [method of death]\``);} - if (args[0] === "kill" || args[0] === "k") {args.shift();} // if someone adds in 'kill' it'll remove it and act like it wasn't there, proceeding as normal. - //if (!args[0].trim().match(/^<@(?:\!?)\d+>$/)) {return message.reply("You have to mention someone!");} - if (mention && mention.id === message.author.id) {return message.reply("Hehe I won't let you write your own name in the notebook! Just leave it somewhere for a few days and someone else will take it. Maybe they'll write your name...");} // users can't mention themselves - if (mention && mention.id === client.user.id) {return message.reply("You can't kill me! Little did you know, I'm actually a death god!");} - if (mention && mention.bot) {return message.reply("As a bot, I simply cannot let you attempt to kill another fellow bot!");} - - let reptype = responses[Object.keys(responses)[Math.floor(Math.random() * Object.keys(responses).length)]]; // report type - let title = reptype.titles[Math.floor(Math.random() * reptype.titles.length)]; - let options = new TagFilter([ - new Tag(['method', '-m', 'cause', '-c'], 'method', 'append'), - new Tag(['victim', 'v', 'against', 'a', 'name', 'n'], 'victim', 'append') - ]).test(args.join(" ")); - - let death = (!options.victim || (options.victim && !options.victim.length)) && (!options.method || (options.method && !options.method.length)) && args.length > 1 - ? args.join(" ").slice(args[0].length + 1) - : deaths[Math.floor(Math.random() * deaths.length)]; //kill method - if (options.method && options.method.length) {death = options.method;} - if (death.length > 750) {return message.channel.send("I'd rather you didn't try to fill the death note with a 7-page double-spaced essay in Times New Roman containing an advanced trajectory theorem on the death of your poor target.");} - - if (!mention && (!options.victim || !options.victim.length)) {return message.reply("You have to write their name down in order to kill them! (In other words, please mention the user whose name you wish to write.)");} - - if (options.victim && options.victim.length) { - let vargs = options.victim.trim().split(/\s+/g); - let nvargs = []; - let varg; for (varg of vargs) { - if (varg.match(/^<@(?:!?)\d+>$/)) { - nvargs.push(message.guild.members.cache.has(varg.slice(varg.search(/\d/), varg.search('>'))) ? message.guild.members.cache.get(varg.slice(varg.search(/\d/), varg.search('>'))).displayName : varg); - } else {nvargs.push(varg);} - } - options.victim = nvargs.join(" ").trim(); - } - let victim = options.victim && options.victim.length ? options.victim : message.mentions.members.first().displayName; - let killer = message.member; - - let pretext = before[Math.floor(Math.random() * before.length)].replace(/{p}/g, victim); - - let note = await message.channel.send(new Discord.MessageEmbed() - .setDescription(pretext) - .setColor('c375f0') - .setFooter("Natsuki", client.user.avatarURL()) - .setTimestamp() - ); - - await require('../util/wait')(2500); - - let text = reptype.texts[Math.floor(Math.random() * reptype.texts.length)] - .replace(/{p}/g, victim) //{p} = victim - .replace(/{pa}/g, victim.toLowerCase().endsWith('s') ? `${victim}'` : `${victim}'s`) //{pa} = victim but with a formatted apostrophe like "WubzyGD's" - .replace(/{c}/g, death) // {c} = death method - .replace(/{w}/g, killer.displayName) // {w} = killer or writer - .replace(/{ds}/g, moment().format("h:mm a")); // {ds} = date small, basically just the time. - // Create and format the kill text - - let dns; - if (mention && mention.id) { - dns = await VC.findOne({uid: message.author.id, countOf: 'dn'}) || new VC({uid: message.author.id, countOf: 'dn'}); - dns.against[mention.id] = dns.against[mention.id] ? dns.against[mention.id] + 1 : 1; - dns.total++; - dns.markModified(`against.${mention.id}`); - dns.save(); - } - - let finalEmbed = new Discord.MessageEmbed() - .setAuthor(title, message.author.avatarURL()) - .setDescription(`${text}${dns ? `\n\n_Their name is in your deathnote **${dns.against[mention.id] === 1 ? 'once' : `${dns.against[mention.id]} times`}.**_` : ''}`) - .setColor('c375f0') - .setFooter(`Natsuki${dns ? ` | ${dns.total} name${dns.total === 1 ? ' has been' : 's'} written in your deathnote!` : ''}`) - .setTimestamp(); - - if (mention) {finalEmbed.setThumbnail(mention.avatarURL({size: 1024}));} - - return note.edit(finalEmbed); - } +const Discord = require('discord.js'); +const moment = require('moment'); + +const VC = require('../../models/vscount'); + +const {Tag} = require('../../util/tag'); +const {TagFilter} = require('../../util/tagfilter'); + +const deaths = [ + "watching too much anime", "an overdose of waifus", "Hypotakunemia", "trying to self-isekai", + "Bass:tm:", "cranking the music just a little too loud", "trying to swim in lava", "an unknown cause", + "Despacito", "something really cliche and unoriginal", "'shrooms", + "clicking 'I agree' without reading the Terms of Service", "alchemy", "rusty spoons", + "picking the wrong waifu", "body pillows", "fur-con", "something to do with lamb sauce", + "grandma's cookies" +]; // a list of preset death methods that can occur + +const before = [ + "A name is being written...", "Someone will perish soon...", "A body is *about* to be discovered...", + "{p} is scribbling something in their notebook...", "\*Manical laughter echoes around you*...", + "{p} laughs maniacally..." +]; // things it says before the response is sent + +const responses = { + /*an obj controlling the possible formats for the death note report*/ + news: { + titles: ["Breaking News"], + texts: [ + "This just in: **{p}** was found dead at **{ds}** today.\n\nAfter some investigation, the authorities ruled the cause of death to be **{c}**.", + "We're now live at the crime scene where it is believed that **{p}** died because of **{c}**.", + "Authorities are reporting what is believed to be another Kira case, where **{c}** has taken the life of **{p}**." + ], + images: [], + }, // a news report of the dead body + writes: { + titles: ["Something sinister just happened", "A name has been written", "Fate has been changed"], + texts: [ + "With a maniacal laugh, **{w}** writes \"**{p}**\" in their Death Note. And the cause of death? They've written **{c}**.", + "**{w}** has sealed **{pa}** fate to die by **{c}**." + ], + images: [] + }, // "so-and-so writes blah blah blah's name in their death note" + /*hasdied: { + texts: [], + images: [] + }, // "so-and-so has died by...", + unserious: { + texts: [], + images: [] + } // other methods, mainly the un-serious or joking ones */ +}; + +//responses.unserious.images = responses.hasdied.images; + +module.exports = { + name: "deathnote", + aliases: ['dn'], + help: new Discord.MessageEmbed() + .setTitle("Help -> Death Note") + .setDescription("Congratulations! You've picked up a death note. Write someone's name in it, and see for yourself if it's the real deal...") + .addField("Syntax", "\`deathnote <@member> [method of death]\`"), + meta: { + category: 'Fun', + description: "Write someone's name in your deathnote. I'm not legally responsible for anything that happens after that.", + syntax: '`deathnote <@member> [method of death]`', + extra: null + }, + async execute(message, msg, args, cmd, prefix, mention, client) { + if (!message.guild) {return message.reply("Unfortunately, this is a **guild-only** command!");} + if (!args.length) {return message.channel.send(`Syntax: \`${prefix}deathnote <@member> [method of death]\``);} + if (args[0] === "kill" || args[0] === "k") {args.shift();} // if someone adds in 'kill' it'll remove it and act like it wasn't there, proceeding as normal. + //if (!args[0].trim().match(/^<@(?:\!?)\d+>$/)) {return message.reply("You have to mention someone!");} + if (mention && mention.id === message.author.id) {return message.reply("Hehe I won't let you write your own name in the notebook! Just leave it somewhere for a few days and someone else will take it. Maybe they'll write your name...");} // users can't mention themselves + if (mention && mention.id === client.user.id) {return message.reply("You can't kill me! Little did you know, I'm actually a death god!");} + if (mention && mention.bot) {return message.reply("As a bot, I simply cannot let you attempt to kill another fellow bot!");} + + let reptype = responses[Object.keys(responses)[Math.floor(Math.random() * Object.keys(responses).length)]]; // report type + let title = reptype.titles[Math.floor(Math.random() * reptype.titles.length)]; + let options = new TagFilter([ + new Tag(['method', '-m', 'cause', '-c'], 'method', 'append'), + new Tag(['victim', 'v', 'against', 'a', 'name', 'n'], 'victim', 'append') + ]).test(args.join(" ")); + + let death = (!options.victim || (options.victim && !options.victim.length)) && (!options.method || (options.method && !options.method.length)) && args.length > 1 + ? args.join(" ").slice(args[0].length + 1) + : deaths[Math.floor(Math.random() * deaths.length)]; //kill method + if (options.method && options.method.length) {death = options.method;} + if (death.length > 750) {return message.channel.send("I'd rather you didn't try to fill the death note with a 7-page double-spaced essay in Times New Roman containing an advanced trajectory theorem on the death of your poor target.");} + + if (!mention && (!options.victim || !options.victim.length)) {return message.reply("You have to write their name down in order to kill them! (In other words, please mention the user whose name you wish to write.)");} + + if (options.victim && options.victim.length) { + let vargs = options.victim.trim().split(/\s+/g); + let nvargs = []; + let varg; for (varg of vargs) { + if (varg.match(/^<@(?:!?)\d+>$/)) { + nvargs.push(message.guild.members.cache.has(varg.slice(varg.search(/\d/), varg.search('>'))) ? message.guild.members.cache.get(varg.slice(varg.search(/\d/), varg.search('>'))).displayName : varg); + } else {nvargs.push(varg);} + } + options.victim = nvargs.join(" ").trim(); + } + let victim = options.victim && options.victim.length ? options.victim : message.mentions.members.first().displayName; + let killer = message.member; + + let pretext = before[Math.floor(Math.random() * before.length)].replace(/{p}/g, victim); + + let note = await message.channel.send(new Discord.MessageEmbed() + .setDescription(pretext) + .setColor('c375f0') + .setFooter("Natsuki", client.user.avatarURL()) + .setTimestamp() + ); + + await require('../../util/wait')(2500); + + let text = reptype.texts[Math.floor(Math.random() * reptype.texts.length)] + .replace(/{p}/g, victim) //{p} = victim + .replace(/{pa}/g, victim.toLowerCase().endsWith('s') ? `${victim}'` : `${victim}'s`) //{pa} = victim but with a formatted apostrophe like "WubzyGD's" + .replace(/{c}/g, death) // {c} = death method + .replace(/{w}/g, killer.displayName) // {w} = killer or writer + .replace(/{ds}/g, moment().format("h:mm a")); // {ds} = date small, basically just the time. + // Create and format the kill text + + let dns; + if (mention && mention.id) { + dns = await VC.findOne({uid: message.author.id, countOf: 'dn'}) || new VC({uid: message.author.id, countOf: 'dn'}); + dns.against[mention.id] = dns.against[mention.id] ? dns.against[mention.id] + 1 : 1; + dns.total++; + dns.markModified(`against.${mention.id}`); + dns.save(); + } + + let finalEmbed = new Discord.MessageEmbed() + .setAuthor(title, message.author.avatarURL()) + .setDescription(`${text}${dns ? `\n\n_Their name is in your deathnote **${dns.against[mention.id] === 1 ? 'once' : `${dns.against[mention.id]} times`}.**_` : ''}`) + .setColor('c375f0') + .setFooter(`Natsuki${dns ? ` | ${dns.total} name${dns.total === 1 ? ' has been' : 's'} written in your deathnote!` : ''}`) + .setTimestamp(); + + if (mention) {finalEmbed.setThumbnail(mention.avatarURL({size: 1024}));} + + return note.edit(finalEmbed); + } }; \ No newline at end of file diff --git a/commands/kiss.js b/commands/fun/kiss.js similarity index 95% rename from commands/kiss.js rename to commands/fun/kiss.js index c8c31bf..37771f3 100644 --- a/commands/kiss.js +++ b/commands/fun/kiss.js @@ -1,7 +1,7 @@ const Discord = require('discord.js'); -const Saves = require('../models/saves'); -const UserData = require('../models/user'); -const makeId = require('../util/makeid'); +const Saves = require('../../models/saves'); +const UserData = require('../../models/user'); +const makeId = require('../../util/makeid'); module.exports = { name: "kiss", diff --git a/commands/secretsanta.js b/commands/fun/secretsanta.js similarity index 98% rename from commands/secretsanta.js rename to commands/fun/secretsanta.js index a97e61e..7bf1709 100644 --- a/commands/secretsanta.js +++ b/commands/fun/secretsanta.js @@ -1,7 +1,7 @@ const Discord = require('discord.js'); -const SS = require('../models/secretsanta'); +const SS = require('../../models/secretsanta'); -const ask = require('../util/ask'); +const ask = require('../../util/ask'); module.exports = { name: "secretsanta", @@ -55,7 +55,7 @@ module.exports = { let id; while (true) { - id = require('../util/makeid')(6); + id = require('../../util/makeid')(6); let test = await SS.findOne({ssid: id}); if (!test) {break;} } diff --git a/commands/slap.js b/commands/fun/slap.js similarity index 94% rename from commands/slap.js rename to commands/fun/slap.js index 421ca08..abcf2ab 100644 --- a/commands/slap.js +++ b/commands/fun/slap.js @@ -1,10 +1,10 @@ const Discord = require('discord.js'); -const Saves = require('../models/saves'); -const UserData = require('../models/user'); -const VC = require('../models/vscount'); +const Saves = require('../../models/saves'); +const UserData = require('../../models/user'); +const VC = require('../../models/vscount'); -const makeId = require('../util/makeid'); +const makeId = require('../../util/makeid'); module.exports = { name: "slap", diff --git a/commands/levelchannel.js b/commands/leveling/levelchannel.js similarity index 96% rename from commands/levelchannel.js rename to commands/leveling/levelchannel.js index a531f46..2e55f2d 100644 --- a/commands/levelchannel.js +++ b/commands/leveling/levelchannel.js @@ -1,7 +1,7 @@ const Discord = require('discord.js'); -const UserData = require('../models/user'); -const LXP = require('../models/localxp'); +const UserData = require('../../models/user'); +const LXP = require('../../models/localxp'); module.exports = { name: "levelchannel", diff --git a/commands/levelrole.js b/commands/leveling/levelrole.js similarity index 97% rename from commands/levelrole.js rename to commands/leveling/levelrole.js index 4b3b3f9..11552fe 100644 --- a/commands/levelrole.js +++ b/commands/leveling/levelrole.js @@ -1,9 +1,9 @@ const Discord = require('discord.js'); -const GuildData = require('../models/guild'); -const LR = require('../models/levelroles'); +const GuildData = require('../../models/guild'); +const LR = require('../../models/levelroles'); -const ask = require('../util/ask'); +const ask = require('../../util/ask'); module.exports = { name: "levelrole", diff --git a/commands/setupleveling.js b/commands/leveling/setupleveling.js similarity index 98% rename from commands/setupleveling.js rename to commands/leveling/setupleveling.js index 184327a..1ae8ca5 100644 --- a/commands/setupleveling.js +++ b/commands/leveling/setupleveling.js @@ -1,6 +1,6 @@ const Discord = require('discord.js'); -const LXP = require('../models/localxp'); +const LXP = require('../../models/localxp'); module.exports = { name: "setupleveling", diff --git a/commands/stats.js b/commands/leveling/stats.js similarity index 97% rename from commands/stats.js rename to commands/leveling/stats.js index dd4b483..1a3f4f9 100644 --- a/commands/stats.js +++ b/commands/leveling/stats.js @@ -1,6 +1,6 @@ const Discord = require('discord.js'); -const LXP = require('../models/localxp'); +const LXP = require('../../models/localxp'); module.exports = { name: "stats", diff --git a/commands/ar.js b/commands/misc/ar.js similarity index 98% rename from commands/ar.js rename to commands/misc/ar.js index af9831f..007e5c5 100644 --- a/commands/ar.js +++ b/commands/misc/ar.js @@ -1,9 +1,9 @@ const Discord = require('discord.js'); -const AR = require('../models/ar'); -const GuildData = require('../models/guild'); +const AR = require('../../models/ar'); +const GuildData = require('../../models/guild'); -const ask = require('../util/ask'); +const ask = require('../../util/ask'); module.exports = { name: "ar", diff --git a/commands/avatar.js b/commands/misc/avatar.js similarity index 93% rename from commands/avatar.js rename to commands/misc/avatar.js index e920a6e..ca3ecbc 100644 --- a/commands/avatar.js +++ b/commands/misc/avatar.js @@ -1,32 +1,32 @@ -const Discord = require('discord.js'); -const {Tag} = require('../util/tag'); -const {TagFilter} = require('../util/tagfilter'); - -module.exports = { - name: "avatar", - aliases: ['av', 'a', 'pfp'], - help: "Use `{{p}}avatar` to get your own profile picture, or mention someone to get theirs!", - meta: { - category: 'Misc', - description: "Flare your avatar or peek at others'", - syntax: '`avatar [@mention]`', - extra: null - }, - async execute(message, msg, args, cmd, prefix, mention, client) { - let member = !args.length ? message.author : mention ? mention : client.users.cache.has(args[0]) ? client.users.cache.get(args[0]) : message.author; - let name = !args.length ? message.member ? message.member.displayName : message.author.username : mention ? mention.username : client.users.cache.has(args[0]) ? client.users.cache.get(args[0]).username : message.author.username; - let options = new TagFilter([ - new Tag(['small', 's', 'mini', 'm'], 'small', 'toggle'), - new Tag(['verysmall', 'vsmall', '-vs', 'xs'], 'vsmall', 'toggle') - ]).test(args.join(" ")); - try { - let avem = new Discord.MessageEmbed() - .setTitle(`${name.endsWith('s') ? `${name}'` : `${name}'s`} Avatar`) - .setImage(member.avatarURL({size: options.vsmall ? 128 : options.small ? 256 : 2048, dynamic: true})) - .setColor('c375f0') - .setFooter("Natsuki", client.user.avatarURL()) - if (!options.vsmall) {avem.setTimestamp();} - return message.channel.send(avem); - } catch {return message.reply("Hmm, there seems to have been an error while I tried to show you that user's avatar.");} - } +const Discord = require('discord.js'); +const {Tag} = require('../../util/tag'); +const {TagFilter} = require('../../util/tagfilter'); + +module.exports = { + name: "avatar", + aliases: ['av', 'a', 'pfp'], + help: "Use `{{p}}avatar` to get your own profile picture, or mention someone to get theirs!", + meta: { + category: 'Misc', + description: "Flare your avatar or peek at others'", + syntax: '`avatar [@mention]`', + extra: null + }, + async execute(message, msg, args, cmd, prefix, mention, client) { + let member = !args.length ? message.author : mention ? mention : client.users.cache.has(args[0]) ? client.users.cache.get(args[0]) : message.author; + let name = !args.length ? message.member ? message.member.displayName : message.author.username : mention ? mention.username : client.users.cache.has(args[0]) ? client.users.cache.get(args[0]).username : message.author.username; + let options = new TagFilter([ + new Tag(['small', 's', 'mini', 'm'], 'small', 'toggle'), + new Tag(['verysmall', 'vsmall', '-vs', 'xs'], 'vsmall', 'toggle') + ]).test(args.join(" ")); + try { + let avem = new Discord.MessageEmbed() + .setTitle(`${name.endsWith('s') ? `${name}'` : `${name}'s`} Avatar`) + .setImage(member.avatarURL({size: options.vsmall ? 128 : options.small ? 256 : 2048, dynamic: true})) + .setColor('c375f0') + .setFooter("Natsuki", client.user.avatarURL()) + if (!options.vsmall) {avem.setTimestamp();} + return message.channel.send(avem); + } catch {return message.reply("Hmm, there seems to have been an error while I tried to show you that user's avatar.");} + } }; \ No newline at end of file diff --git a/commands/help.js b/commands/misc/help.js similarity index 96% rename from commands/help.js rename to commands/misc/help.js index 2e0f32d..9eaac85 100644 --- a/commands/help.js +++ b/commands/misc/help.js @@ -1,73 +1,73 @@ -const Discord = require("discord.js"); - -const {Pagination} = require('../util/pagination'); -const ask = require('../util/ask'); - -module.exports = { - name: "help", - aliases: ["h", "commands", "cmds"], - help: 'you silly! What did you expect me to respond with?', - async execute(message, msg, args, cmd, prefix, mention, client) { - if (!args.length) { - let sorted = {}; - await Array.from(client.commands.values()).forEach(command => {if (command.name !== "help" && command.meta) { - sorted[command.meta.category] = sorted[command.meta.category] ? sorted[command.meta.category] : {}; - sorted[command.meta.category][command.name] = command; - }}); - let helpSorted = {}; - let category; for (category of Object.keys(sorted)) { - let categorySorted = []; - let current = 1; - let currentEmbed = new Discord.MessageEmbed().setAuthor("Help Menu", message.author.avatarURL()).setTitle(category).setDescription("React to control the menu! You can also specify a command name when doing the help command to get more info about it.").setColor("c375f0"); - let commands = Object.keys(sorted[category]); - let command; for (command of commands) { - let aliases = ''; - let a; if (sorted[category][command].aliases) {for (a of sorted[category][command].aliases) {aliases += `\`${a}\`, `}} - aliases = aliases.length ? aliases.slice(0, aliases.length - 2) : 'None'; - currentEmbed.addField(`${command.slice(0,1).toUpperCase()}${command.slice(1)}`, `${sorted[category][command].meta.description}\n\nAliases: ${aliases}\nSyntax: ${sorted[category][command].meta.syntax}${sorted[category][command].meta.extra ? '\n\n' + sorted[category][command].meta.extra : ''}`); - current += 1; - if (current === 5) { - categorySorted.push(currentEmbed); - current = 1; - currentEmbed = new Discord.MessageEmbed().setAuthor("Help Menu", message.author.avatarURL()).setTitle(category).setDescription("React to control the menu! You can also specify a command name when doing the help command to get more info about it.").setColor("c375f0"); - } - } - if (current > 1) {categorySorted.push(currentEmbed);} - helpSorted[category] = categorySorted; - } - - let cat = await ask(message, "What would you like help with? (`Fun`|`Roleplay`|`Utility`|`Misc`|`Moderation`|`Social`|`Leveling`) or `all` if you'd like to browse all commands", 60000); if (!cat) {return;} - if (!['f', 'fun', 'rp', 'roleplay', 'dnd', 'role play', 'rpg', 'dice', 'u', 'util', 'utility', 'utilities', 'm', 'misc', 'miscellaneous', 'mod', 'moderation', 's', 'social', 'leveling', 'l', 'level', 'a', 'all'].includes(`${cat}`.trim().toLowerCase())) {return message.channel.send("That wasn't a valid response! Try again?");} - - let pages; - if (['f', 'fun'].includes(`${cat}`.trim().toLowerCase())) {pages = helpSorted['Fun'];} - if (['roleplay', 'dnd', 'role play', 'rpg', 'dice'].includes(`${cat}`.trim().toLowerCase())) {pages = helpSorted['RP'];} - if (['u', 'util', 'utility', 'utilities'].includes(`${cat}`.trim().toLowerCase())) {pages = helpSorted['Utility'];} - if (['m', 'misc', 'miscellaneous'].includes(`${cat}`.trim().toLowerCase())) {pages = helpSorted['Misc'];} - if (['d', 'dev', 'developer'].includes(`${cat}`.trim().toLowerCase())) {pages = helpSorted['Developer'];} - if (['mod', 'moderation'].includes(`${cat}`.trim().toLowerCase())) {pages = helpSorted['Moderation'];} - if (['s', 'social'].includes(`${cat}`.trim().toLowerCase())) {pages = helpSorted['Social'];} - if (['l', 'leveling', 'level'].includes(`${cat}`.trim().toLowerCase())) {pages = helpSorted['Leveling'];} - if (['a', 'all'].includes(`${cat}`.trim().toLowerCase())) {pages = []; let c; for (c of Object.values(helpSorted)) {let h; for (h of c) {pages.push(h)}}} - - await require('../util/wait')(500); - - if (pages.length > 1) { - let help = new Pagination(message.channel, pages, message, client, true); - return await help.start({endTime: 120000, user: message.author.id}); - } else {return message.channel.send(pages[0].setFooter("Natsuki", client.user.avatarURL()).setTimestamp());} - } else { - let command; - if (client.commands.has(args[0])) {command = client.commands.get(args[0]);} - else if (client.aliases.has(args[0])) {command = client.commands.get(client.aliases.get(args[0]));} - else {return message.reply("I don't have that command! Try using `" + prefix + "help` to get a list of my commands");} - - return message.reply(command.help - ? command.help instanceof Discord.MessageEmbed - ? command.help.setFooter("Natsuki | [optional]", client.user.avatarURL()).setColor("c375f0").setTimestamp() - : command.help.replace(/{{p}}/g, prefix) - : "I don't seem to have any help info available for that command." - ); - } - } +const Discord = require("discord.js"); + +const {Pagination} = require('../../util/pagination'); +const ask = require('../../util/ask'); + +module.exports = { + name: "help", + aliases: ["h", "commands", "cmds"], + help: 'you silly! What did you expect me to respond with?', + async execute(message, msg, args, cmd, prefix, mention, client) { + if (!args.length) { + let sorted = {}; + await Array.from(client.commands.values()).forEach(command => {if (command.name !== "help" && command.meta) { + sorted[command.meta.category] = sorted[command.meta.category] ? sorted[command.meta.category] : {}; + sorted[command.meta.category][command.name] = command; + }}); + let helpSorted = {}; + let category; for (category of Object.keys(sorted)) { + let categorySorted = []; + let current = 1; + let currentEmbed = new Discord.MessageEmbed().setAuthor("Help Menu", message.author.avatarURL()).setTitle(category).setDescription("React to control the menu! You can also specify a command name when doing the help command to get more info about it.").setColor("c375f0"); + let commands = Object.keys(sorted[category]); + let command; for (command of commands) { + let aliases = ''; + let a; if (sorted[category][command].aliases) {for (a of sorted[category][command].aliases) {aliases += `\`${a}\`, `}} + aliases = aliases.length ? aliases.slice(0, aliases.length - 2) : 'None'; + currentEmbed.addField(`${command.slice(0,1).toUpperCase()}${command.slice(1)}`, `${sorted[category][command].meta.description}\n\nAliases: ${aliases}\nSyntax: ${sorted[category][command].meta.syntax}${sorted[category][command].meta.extra ? '\n\n' + sorted[category][command].meta.extra : ''}`); + current += 1; + if (current === 5) { + categorySorted.push(currentEmbed); + current = 1; + currentEmbed = new Discord.MessageEmbed().setAuthor("Help Menu", message.author.avatarURL()).setTitle(category).setDescription("React to control the menu! You can also specify a command name when doing the help command to get more info about it.").setColor("c375f0"); + } + } + if (current > 1) {categorySorted.push(currentEmbed);} + helpSorted[category] = categorySorted; + } + + let cat = await ask(message, "What would you like help with? (`Fun`|`Roleplay`|`Utility`|`Misc`|`Moderation`|`Social`|`Leveling`) or `all` if you'd like to browse all commands", 60000); if (!cat) {return;} + if (!['f', 'fun', 'rp', 'roleplay', 'dnd', 'role play', 'rpg', 'dice', 'u', 'util', 'utility', 'utilities', 'm', 'misc', 'miscellaneous', 'mod', 'moderation', 's', 'social', 'leveling', 'l', 'level', 'a', 'all'].includes(`${cat}`.trim().toLowerCase())) {return message.channel.send("That wasn't a valid response! Try again?");} + + let pages; + if (['f', 'fun'].includes(`${cat}`.trim().toLowerCase())) {pages = helpSorted['Fun'];} + if (['roleplay', 'dnd', 'role play', 'rpg', 'dice'].includes(`${cat}`.trim().toLowerCase())) {pages = helpSorted['RP'];} + if (['u', 'util', 'utility', 'utilities'].includes(`${cat}`.trim().toLowerCase())) {pages = helpSorted['Utility'];} + if (['m', 'misc', 'miscellaneous'].includes(`${cat}`.trim().toLowerCase())) {pages = helpSorted['Misc'];} + if (['d', 'dev', 'developer'].includes(`${cat}`.trim().toLowerCase())) {pages = helpSorted['Developer'];} + if (['mod', 'moderation'].includes(`${cat}`.trim().toLowerCase())) {pages = helpSorted['Moderation'];} + if (['s', 'social'].includes(`${cat}`.trim().toLowerCase())) {pages = helpSorted['Social'];} + if (['l', 'leveling', 'level'].includes(`${cat}`.trim().toLowerCase())) {pages = helpSorted['Leveling'];} + if (['a', 'all'].includes(`${cat}`.trim().toLowerCase())) {pages = []; let c; for (c of Object.values(helpSorted)) {let h; for (h of c) {pages.push(h)}}} + + await require('../../util/wait')(500); + + if (pages.length > 1) { + let help = new Pagination(message.channel, pages, message, client, true); + return await help.start({endTime: 120000, user: message.author.id}); + } else {return message.channel.send(pages[0].setFooter("Natsuki", client.user.avatarURL()).setTimestamp());} + } else { + let command; + if (client.commands.has(args[0])) {command = client.commands.get(args[0]);} + else if (client.aliases.has(args[0])) {command = client.commands.get(client.aliases.get(args[0]));} + else {return message.reply("I don't have that command! Try using `" + prefix + "help` to get a list of my commands");} + + return message.reply(command.help + ? command.help instanceof Discord.MessageEmbed + ? command.help.setFooter("Natsuki | [optional]", client.user.avatarURL()).setColor("c375f0").setTimestamp() + : command.help.replace(/{{p}}/g, prefix) + : "I don't seem to have any help info available for that command." + ); + } + } }; \ No newline at end of file diff --git a/commands/info.js b/commands/misc/info.js similarity index 94% rename from commands/info.js rename to commands/misc/info.js index 56b0935..bbde0bb 100644 --- a/commands/info.js +++ b/commands/misc/info.js @@ -12,7 +12,7 @@ module.exports = { extra: null }, async execute(message, msg, args, cmd, prefix, mention, client) { - let botData = await require('../models/bot').findOne({finder: 'lel'}); + let botData = await require('../../models/bot').findOne({finder: 'lel'}); return message.channel.send(new Discord.MessageEmbed() .setAuthor("About Me!", client.users.cache.get(client.developers[Math.floor(Math.random() * client.developers.length)]).avatarURL()) diff --git a/commands/ingorear.js b/commands/misc/ingorear.js similarity index 96% rename from commands/ingorear.js rename to commands/misc/ingorear.js index e41e5fc..a0fd217 100644 --- a/commands/ingorear.js +++ b/commands/misc/ingorear.js @@ -1,7 +1,7 @@ const Discord = require('discord.js'); -const AR = require('../models/ar'); -const GuildData = require('../models/guild'); +const AR = require('../../models/ar'); +const GuildData = require('../../models/guild'); module.exports = { name: "ignorear", diff --git a/commands/invite.js b/commands/misc/invite.js similarity index 100% rename from commands/invite.js rename to commands/misc/invite.js diff --git a/commands/prefix.js b/commands/misc/prefix.js similarity index 96% rename from commands/prefix.js rename to commands/misc/prefix.js index 78f9bb5..cfe6504 100644 --- a/commands/prefix.js +++ b/commands/misc/prefix.js @@ -1,6 +1,6 @@ const Discord = require('discord.js'); const mongoose = require('mongoose'); -const GuildSettings = require('../models/guild'); +const GuildSettings = require('../../models/guild'); module.exports = { name: "prefix", @@ -34,7 +34,7 @@ module.exports = { } client.guildconfig.prefixes.set(message.guild.id, np); let upm = await message.reply("sure thing!"); - await require('../util/wait')(1750); + await require('../../util/wait')(1750); return upm.edit(new Discord.MessageEmbed() .setAuthor('Prefix updated!', message.author.avatarURL()) .setDescription(`New prefix: \`${np}\``) diff --git a/commands/supportserver.js b/commands/misc/supportserver.js similarity index 100% rename from commands/supportserver.js rename to commands/misc/supportserver.js diff --git a/commands/userinfo.js b/commands/misc/userinfo.js similarity index 98% rename from commands/userinfo.js rename to commands/misc/userinfo.js index fc8f627..d9c59b9 100644 --- a/commands/userinfo.js +++ b/commands/misc/userinfo.js @@ -1,7 +1,7 @@ const Discord = require('discord.js'); const moment = require('moment'); const mongoose = require('mongoose'); -const UserData = require('../models/user'); +const UserData = require('../../models/user'); module.exports = { name: "userinfo", diff --git a/commands/autorole.js b/commands/moderation/autorole.js similarity index 97% rename from commands/autorole.js rename to commands/moderation/autorole.js index 05b757d..52c5a9e 100644 --- a/commands/autorole.js +++ b/commands/moderation/autorole.js @@ -1,5 +1,5 @@ const Discord = require('discord.js'); -const GuildData = require('../models/guild'); +const GuildData = require('../../models/guild'); module.exports = { name: "autorole", diff --git a/commands/ban.js b/commands/moderation/ban.js similarity index 97% rename from commands/ban.js rename to commands/moderation/ban.js index 6073e79..7716479 100644 --- a/commands/ban.js +++ b/commands/moderation/ban.js @@ -1,9 +1,9 @@ const Discord = require('discord.js'); -const Mod = require('../models/mod'); +const Mod = require('../../models/mod'); -const {Tag} = require('../util/tag'); -const {TagFilter} = require('../util/tagfilter'); +const {Tag} = require('../../util/tag'); +const {TagFilter} = require('../../util/tagfilter'); module.exports = { name: "ban", diff --git a/commands/clearwarnings.js b/commands/moderation/clearwarnings.js similarity index 98% rename from commands/clearwarnings.js rename to commands/moderation/clearwarnings.js index a9fd5da..474a6c4 100644 --- a/commands/clearwarnings.js +++ b/commands/moderation/clearwarnings.js @@ -1,6 +1,6 @@ const Discord = require('discord.js'); -const Mod = require('../models/mod'); +const Mod = require('../../models/mod'); module.exports = { name: "clearwarnings", diff --git a/commands/kick.js b/commands/moderation/kick.js similarity index 96% rename from commands/kick.js rename to commands/moderation/kick.js index 456a28d..73fd359 100644 --- a/commands/kick.js +++ b/commands/moderation/kick.js @@ -1,9 +1,9 @@ const Discord = require('discord.js'); -const Mod = require('../models/mod'); +const Mod = require('../../models/mod'); -const {Tag} = require('../util/tag'); -const {TagFilter} = require('../util/tagfilter'); +const {Tag} = require('../../util/tag'); +const {TagFilter} = require('../../util/tagfilter'); module.exports = { name: "kick", diff --git a/commands/leave.js b/commands/moderation/leave.js similarity index 96% rename from commands/leave.js rename to commands/moderation/leave.js index c73aae0..578478e 100644 --- a/commands/leave.js +++ b/commands/moderation/leave.js @@ -1,7 +1,7 @@ const Discord = require('discord.js'); -const GuildData = require('../models/guild'); -const Responses = require('../models/responses'); -const sendResponse = require('../util/response/sendresponse'); +const GuildData = require('../../models/guild'); +const Responses = require('../../models/responses'); +const sendResponse = require('../../util/response/sendresponse'); module.exports = { name: "leave", diff --git a/commands/logs.js b/commands/moderation/logs.js similarity index 96% rename from commands/logs.js rename to commands/moderation/logs.js index 8cda3bf..7e84e66 100644 --- a/commands/logs.js +++ b/commands/moderation/logs.js @@ -1,85 +1,85 @@ -const Discord = require("discord.js"); - -const GuildData = require('../models/guild'); -const LogData = require('../models/log'); - - -const ObjLogTypes = { - mdelete: ['md', 'mdelete', 'messagedelete', 'deletemessage', 'deletemsg', 'msgdelete'], - medit: ['me', 'medit', 'messageedit', 'editmessage', 'msgedit', 'editmsg'], - chnew: ['chn', 'chc', 'newch', 'newchannel', 'chcreate', 'channelcreate'], - //chedit: ['channeledit'], - chdelete: ['chd', 'channeldelete', 'deletechannel', 'deletech', 'chdelete'], - //vcjoin: [], - //vcleave: [], - //servervcmute: [], - //servervcdeafen: [], - //kick: [], - //ban: [], - //mute: [], - //warn: [], - //giverole: [], - //takerole: [], - //addrole: [], - //editrole: [], - //deleterole: [], - //serverjoin: [], - //serverleave: [], - //nickname: [], - //username: [], - //avatar: [] -}; const LogTypes = new Map(); - -let keys = Object.keys(ObjLogTypes); -let key; for (key of keys) {let vs = ObjLogTypes[key]; let v; for (v of vs) {LogTypes.set(v, key);}} - - -module.exports = { - name: "logs", - aliases: ["log", "l", "modlog", "modlogs"], - help: new Discord.MessageEmbed() - .setTitle("Help -> Server Logs") - .setDescription("Configure your server's log settings.\n\nLogs will update you on events in your server that have the potential to require moderator intervention, like someone deleting a hateful message before you can see it or a misbehaving moderator kicking/banning a member when they aren't supposed to.") - .addField("Syntax", "`log [logType] [#channel]`") - .addField("Notice", "You must be an admin or have the specified staff role in order to use this command."), - meta: { - category: 'Moderation', - description: "Configure your server's log settings, which allow mods to see potentially suspicious activity in the server.", - syntax: '`log [logType] [#channel]`', - extra: "**Please note** that this command is still in the works, and that not all log types are available. The currently existing ones have been thoroughly tested, though." - }, - async execute(message, msg, args, cmd, prefix, mention, client) { - if (!message.guild) {return message.reply("This command is server-only!");} - let tg = await GuildData.findOne({gid: message.guild.id}); - if ((!message.member.permissions.has("ADMINISTRATOR")) && (!tg || !tg.staffrole || !tg.staffrole.length || !message.member.roles.cache.has(tg.staffrole))) {return message.reply("You must be an administrator or have the specified staff role in this server in order to edit or view log settings.");} - if (!args.length) {return message.channel.send(`Syntax: \`${prefix}log [logType] [#channel]\``);} - - if (['s', 'set'].includes(args[0].toLowerCase())) { - if (args.length < 3) {return message.channel.send(`You must specify the log type and the channel to send the log to. Use \`${prefix}log list\` to see a list of valid log types.`);} - if (!LogTypes.has(args[1].toLowerCase())) {return message.channel.send("That's not a valid log type. Use \`${prefix}log list\` to see a list of valid log types.");} - let lt = LogTypes.get(args[1].toLowerCase()); - let ch = args[2].match(/<\#(?:\d+)>/m) && message.guild.channels.cache.has(message.mentions.channels.first().id) ? message.mentions.channels.first() : message.guild.channels.cache.has(args[2]) ? message.guild.channels.cache.get(args[2]) : null; - if (!ch) {return message.channel.send("I can't find that channel! Make sure that you've mentioned one, or that the ID you provided is correct, and that I can see it.");} - if (!ch.permissionsFor(client.user.id).has("SEND_MESSAGES")) {return message.reply("I don't have permissions to send messages in that channel. Please give me access and try again.");} - let tl = await LogData.findOne({gid: message.guild.id}) || new LogData({gid: message.guild.id}); - tl[lt] = ch.id; - tl.save(); - if (!client.guildconfig.logs.has(message.guild.id)) {client.guildconfig.logs.set(message.guild.id, new Map());} - client.guildconfig.logs.get(message.guild.id).set(lt, ch.id); - return message.channel.send("Log settings updated!") - } - - if (['l', 'list'].includes(args[0].toLowerCase())) { - return message.channel.send("Valid log types:\n\n-`msgdelete` - Shows the content of a message that was deleted, in any channel.\n-`msgedit` - Shows both the old and new versions of a message when it is edited."); - } - - if (['v', 'view'].includes(args[0].toLowerCase())) { - if (client.guildconfig.logs.has(message.guild.id) && client.guildconfig.logs.get(message.guild.id).size) {return message.channel.send(`This server's logs: \n\n${function bonk(){let s = ''; Array.from(client.guildconfig.logs.get(message.guild.id).keys()).forEach(v => s+=`\`${v}\`: <#${client.guildconfig.logs.get(message.guild.id).get(v)}>, `); return s;}().slice(0, -2)}`);} - else {return message.channel.send("Your server doesn't have any logs set up at the moment, or they aren't cached. If you keep seeing this issue even after setting logs, please contact my developers!");} - } - - if (['c', 'clear'].includes(args[0].toLowerCase())) { - - } - } +const Discord = require("discord.js"); + +const GuildData = require('../../models/guild'); +const LogData = require('../../models/log'); + + +const ObjLogTypes = { + mdelete: ['md', 'mdelete', 'messagedelete', 'deletemessage', 'deletemsg', 'msgdelete'], + medit: ['me', 'medit', 'messageedit', 'editmessage', 'msgedit', 'editmsg'], + chnew: ['chn', 'chc', 'newch', 'newchannel', 'chcreate', 'channelcreate'], + //chedit: ['channeledit'], + chdelete: ['chd', 'channeldelete', 'deletechannel', 'deletech', 'chdelete'], + //vcjoin: [], + //vcleave: [], + //servervcmute: [], + //servervcdeafen: [], + //kick: [], + //ban: [], + //mute: [], + //warn: [], + //giverole: [], + //takerole: [], + //addrole: [], + //editrole: [], + //deleterole: [], + //serverjoin: [], + //serverleave: [], + //nickname: [], + //username: [], + //avatar: [] +}; const LogTypes = new Map(); + +let keys = Object.keys(ObjLogTypes); +let key; for (key of keys) {let vs = ObjLogTypes[key]; let v; for (v of vs) {LogTypes.set(v, key);}} + + +module.exports = { + name: "logs", + aliases: ["log", "l", "modlog", "modlogs"], + help: new Discord.MessageEmbed() + .setTitle("Help -> Server Logs") + .setDescription("Configure your server's log settings.\n\nLogs will update you on events in your server that have the potential to require moderator intervention, like someone deleting a hateful message before you can see it or a misbehaving moderator kicking/banning a member when they aren't supposed to.") + .addField("Syntax", "`log [logType] [#channel]`") + .addField("Notice", "You must be an admin or have the specified staff role in order to use this command."), + meta: { + category: 'Moderation', + description: "Configure your server's log settings, which allow mods to see potentially suspicious activity in the server.", + syntax: '`log [logType] [#channel]`', + extra: "**Please note** that this command is still in the works, and that not all log types are available. The currently existing ones have been thoroughly tested, though." + }, + async execute(message, msg, args, cmd, prefix, mention, client) { + if (!message.guild) {return message.reply("This command is server-only!");} + let tg = await GuildData.findOne({gid: message.guild.id}); + if ((!message.member.permissions.has("ADMINISTRATOR")) && (!tg || !tg.staffrole || !tg.staffrole.length || !message.member.roles.cache.has(tg.staffrole))) {return message.reply("You must be an administrator or have the specified staff role in this server in order to edit or view log settings.");} + if (!args.length) {return message.channel.send(`Syntax: \`${prefix}log [logType] [#channel]\``);} + + if (['s', 'set'].includes(args[0].toLowerCase())) { + if (args.length < 3) {return message.channel.send(`You must specify the log type and the channel to send the log to. Use \`${prefix}log list\` to see a list of valid log types.`);} + if (!LogTypes.has(args[1].toLowerCase())) {return message.channel.send("That's not a valid log type. Use \`${prefix}log list\` to see a list of valid log types.");} + let lt = LogTypes.get(args[1].toLowerCase()); + let ch = args[2].match(/<\#(?:\d+)>/m) && message.guild.channels.cache.has(message.mentions.channels.first().id) ? message.mentions.channels.first() : message.guild.channels.cache.has(args[2]) ? message.guild.channels.cache.get(args[2]) : null; + if (!ch) {return message.channel.send("I can't find that channel! Make sure that you've mentioned one, or that the ID you provided is correct, and that I can see it.");} + if (!ch.permissionsFor(client.user.id).has("SEND_MESSAGES")) {return message.reply("I don't have permissions to send messages in that channel. Please give me access and try again.");} + let tl = await LogData.findOne({gid: message.guild.id}) || new LogData({gid: message.guild.id}); + tl[lt] = ch.id; + tl.save(); + if (!client.guildconfig.logs.has(message.guild.id)) {client.guildconfig.logs.set(message.guild.id, new Map());} + client.guildconfig.logs.get(message.guild.id).set(lt, ch.id); + return message.channel.send("Log settings updated!") + } + + if (['l', 'list'].includes(args[0].toLowerCase())) { + return message.channel.send("Valid log types:\n\n-`msgdelete` - Shows the content of a message that was deleted, in any channel.\n-`msgedit` - Shows both the old and new versions of a message when it is edited."); + } + + if (['v', 'view'].includes(args[0].toLowerCase())) { + if (client.guildconfig.logs.has(message.guild.id) && client.guildconfig.logs.get(message.guild.id).size) {return message.channel.send(`This server's logs: \n\n${function bonk(){let s = ''; Array.from(client.guildconfig.logs.get(message.guild.id).keys()).forEach(v => s+=`\`${v}\`: <#${client.guildconfig.logs.get(message.guild.id).get(v)}>, `); return s;}().slice(0, -2)}`);} + else {return message.channel.send("Your server doesn't have any logs set up at the moment, or they aren't cached. If you keep seeing this issue even after setting logs, please contact my developers!");} + } + + if (['c', 'clear'].includes(args[0].toLowerCase())) { + + } + } }; \ No newline at end of file diff --git a/commands/response.js b/commands/moderation/response.js similarity index 93% rename from commands/response.js rename to commands/moderation/response.js index c6df9b2..f2926f8 100644 --- a/commands/response.js +++ b/commands/moderation/response.js @@ -1,12 +1,12 @@ const Discord = require('discord.js'); -const GuildData = require('../models/guild'); -const Responses = require('../models/responses'); +const GuildData = require('../../models/guild'); +const Responses = require('../../models/responses'); -const sendResponse = require('../util/response/sendresponse'); -const parseResponse = require('../util/response/parseresponse'); -const saveResponse = require('../util/response/saveresponse'); -const getResponse = require('../util/response/getresponse'); +const sendResponse = require('../../util/response/sendresponse'); +const parseResponse = require('../../util/response/parseresponse'); +const saveResponse = require('../../util/response/saveresponse'); +const getResponse = require('../../util/response/getresponse'); module.exports = { name: "response", diff --git a/commands/softban.js b/commands/moderation/softban.js similarity index 98% rename from commands/softban.js rename to commands/moderation/softban.js index adda0c8..b8d1826 100644 --- a/commands/softban.js +++ b/commands/moderation/softban.js @@ -1,7 +1,7 @@ const Discord = require('discord.js'); -const {Tag} = require("../util/tag"); -const {TagFilter} = require("../util/tagfilter"); +const {Tag} = require("../../util/tag"); +const {TagFilter} = require("../../util/tagfilter"); module.exports = { name: "softban", diff --git a/commands/staffrole.js b/commands/moderation/staffrole.js similarity index 96% rename from commands/staffrole.js rename to commands/moderation/staffrole.js index 05235d6..25826e4 100644 --- a/commands/staffrole.js +++ b/commands/moderation/staffrole.js @@ -1,6 +1,6 @@ const Discord = require('discord.js'); const mongoose = require('mongoose'); -const GuildSettings = require('../models/guild'); +const GuildSettings = require('../../models/guild'); module.exports = { name: "staffrole", @@ -40,7 +40,7 @@ module.exports = { tguild.staffrole = role.id; tguild.save(); let upm = await message.reply("sure thing!"); - await require('../util/wait')(1750); + await require('../../util/wait')(1750); return upm.edit(new Discord.MessageEmbed() .setAuthor('Staff role updated!', message.author.avatarURL()) .setDescription(`<@&${tguild.staffrole}> can now edit my settings in this server.`) diff --git a/commands/togglestatuses.js b/commands/moderation/togglestatuses.js similarity index 95% rename from commands/togglestatuses.js rename to commands/moderation/togglestatuses.js index 74fc4e6..0290cc9 100644 --- a/commands/togglestatuses.js +++ b/commands/moderation/togglestatuses.js @@ -1,27 +1,27 @@ -const Discord = require('discord.js'); -const GuildSettings = require('../models/guild'); - -module.exports = { - name: "togglestatuses", - aliases: ['ts', 'tsw', 'togglestatuswarnings', 'togglestatus', 'statustoggle', 'statusestoggle'], - help: new Discord.MessageEmbed() - .setTitle("Help -> Server Status-Toggling") - .setDescription("Disables or enables the warning that appears when you ping someone that has a status set.") - .addField("Syntax", "`togglestatuses [c]` (add `c` to the end of the message if you want to check if they're enabled or not.)"), - meta: { - category: 'Moderation', - description: "Toggle the warning I give members when they ping someone with a status. Some people find it annoying, but here's my mute button!", - syntax: '`togglestatuses [-c]`', - extra: null - }, - async execute(message, msg, args, cmd, prefix, mention, client) { - if (!message.guild) {return message.reply('You must be in a server to use this command.');} - let tg = await GuildSettings.findOne({gid: message.guild.id}); - if (!message.member.permissions.has('ADMINISTRATOR') && (tg && tg.staffrole.length && !message.member.roles.cache.has(tg.staffrole))) {return message.reply("You don't have permissions to use this command in your server.");} - if (args[0] && ['c', 'check', 'v', 'view'].includes(args[0].toLowerCase())) {return message.channel.send(`I ${tg && !tg.nostatus ? 'will' : 'will not'} send a warning when pinging a member with a status.`);} - if (!tg) {tg = new GuildSettings({gid: message.guild.id});} - tg.nostatus = !tg.nostatus; - tg.save(); - return message.channel.send(`I ${!tg.nostatus ? 'will' : 'will not'} send a warning when pinging a member with a status.`); - } +const Discord = require('discord.js'); +const GuildSettings = require('../../models/guild'); + +module.exports = { + name: "togglestatuses", + aliases: ['ts', 'tsw', 'togglestatuswarnings', 'togglestatus', 'statustoggle', 'statusestoggle'], + help: new Discord.MessageEmbed() + .setTitle("Help -> Server Status-Toggling") + .setDescription("Disables or enables the warning that appears when you ping someone that has a status set.") + .addField("Syntax", "`togglestatuses [c]` (add `c` to the end of the message if you want to check if they're enabled or not.)"), + meta: { + category: 'Moderation', + description: "Toggle the warning I give members when they ping someone with a status. Some people find it annoying, but here's my mute button!", + syntax: '`togglestatuses [-c]`', + extra: null + }, + async execute(message, msg, args, cmd, prefix, mention, client) { + if (!message.guild) {return message.reply('You must be in a server to use this command.');} + let tg = await GuildSettings.findOne({gid: message.guild.id}); + if (!message.member.permissions.has('ADMINISTRATOR') && (tg && tg.staffrole.length && !message.member.roles.cache.has(tg.staffrole))) {return message.reply("You don't have permissions to use this command in your server.");} + if (args[0] && ['c', 'check', 'v', 'view'].includes(args[0].toLowerCase())) {return message.channel.send(`I ${tg && !tg.nostatus ? 'will' : 'will not'} send a warning when pinging a member with a status.`);} + if (!tg) {tg = new GuildSettings({gid: message.guild.id});} + tg.nostatus = !tg.nostatus; + tg.save(); + return message.channel.send(`I ${!tg.nostatus ? 'will' : 'will not'} send a warning when pinging a member with a status.`); + } }; \ No newline at end of file diff --git a/commands/unban.js b/commands/moderation/unban.js similarity index 100% rename from commands/unban.js rename to commands/moderation/unban.js diff --git a/commands/warn.js b/commands/moderation/warn.js similarity index 98% rename from commands/warn.js rename to commands/moderation/warn.js index f1b8122..60008aa 100644 --- a/commands/warn.js +++ b/commands/moderation/warn.js @@ -1,9 +1,9 @@ const Discord = require('discord.js'); -const Mod = require('../models/mod'); +const Mod = require('../../models/mod'); -const {TagFilter} = require('../util/tagfilter'); -const {Tag} = require('../util/tag'); +const {TagFilter} = require('../../util/tagfilter'); +const {Tag} = require('../../util/tag'); module.exports = { name: "warn", diff --git a/commands/welcome.js b/commands/moderation/welcome.js similarity index 96% rename from commands/welcome.js rename to commands/moderation/welcome.js index fe0d511..fa30f07 100644 --- a/commands/welcome.js +++ b/commands/moderation/welcome.js @@ -1,7 +1,7 @@ const Discord = require('discord.js'); -const GuildData = require('../models/guild'); -const Responses = require('../models/responses'); -const sendResponse = require('../util/response/sendresponse'); +const GuildData = require('../../models/guild'); +const Responses = require('../../models/responses'); +const sendResponse = require('../../util/response/sendresponse'); module.exports = { name: "welcome", diff --git a/commands/afk.js b/commands/social/afk.js similarity index 92% rename from commands/afk.js rename to commands/social/afk.js index 9a9e795..923c2a8 100644 --- a/commands/afk.js +++ b/commands/social/afk.js @@ -1,6 +1,6 @@ const Discord = require('discord.js'); const mongoose = require('mongoose'); -const UserData = require('../models/user'); +const UserData = require('../../models/user'); module.exports = { name: "afk", @@ -34,7 +34,7 @@ module.exports = { let tempDate = new Date(); tu.statusclearat = tempDate.setHours(tempDate.getHours() + 12); tu.save(); - require('../util/cachestatus')(message.author.id, tempDate.setHours(tempDate.getHours() + 12)); + require('../../util/cachestatus')(message.author.id, tempDate.setHours(tempDate.getHours() + 12)); return message.reply(`I set your ${tu.statusclearmode === 'auto' ? 'automatically' : 'manually'}-clearing AFK message to: ${reason.trim()}`); } }; \ No newline at end of file diff --git a/commands/bio.js b/commands/social/bio.js similarity index 98% rename from commands/bio.js rename to commands/social/bio.js index ea81b0d..91a7212 100644 --- a/commands/bio.js +++ b/commands/social/bio.js @@ -1,5 +1,5 @@ const Discord = require('discord.js'); -const UserData = require('../models/user'); +const UserData = require('../../models/user'); module.exports = { name: "bio", diff --git a/commands/clearstatus.js b/commands/social/clearstatus.js similarity index 88% rename from commands/clearstatus.js rename to commands/social/clearstatus.js index c133b52..e449d41 100644 --- a/commands/clearstatus.js +++ b/commands/social/clearstatus.js @@ -1,7 +1,7 @@ const Discord = require('discord.js'); const mongooes = require('mongoose'); -const UserData = require('../models/user'); +const UserData = require('../../models/user'); module.exports = { name: "clearstatus", @@ -20,7 +20,7 @@ module.exports = { tu.statusmsg = ''; tu.statustype = ''; tu.save(); - require('../util/siftstatuses')(client, message.author.id, true); + require('../../util/siftstatuses')(client, message.author.id, true); return message.reply("welcome back! I cleared your status.").then(m => {m.delete({timeout: 5000}).then(() => {if (message.guild && message.guild.me.permissions.has("DELETE_MESSAGES")) {message.delete().catch(() => {});}})}); } }; \ No newline at end of file diff --git a/commands/cry.js b/commands/social/cry.js similarity index 92% rename from commands/cry.js rename to commands/social/cry.js index 1ed3b9d..145e7ca 100644 --- a/commands/cry.js +++ b/commands/social/cry.js @@ -1,7 +1,7 @@ const Discord = require('discord.js'); -const Saves = require('../models/saves'); -const UserData = require('../models/user'); -const makeId = require('../util/makeid'); +const Saves = require('../../models/saves'); +const UserData = require('../../models/user'); +const makeId = require('../../util/makeid'); module.exports = { name: "cry", diff --git a/commands/dnd.js b/commands/social/dnd.js similarity index 92% rename from commands/dnd.js rename to commands/social/dnd.js index 96633ee..53dbc0e 100644 --- a/commands/dnd.js +++ b/commands/social/dnd.js @@ -1,6 +1,6 @@ const Discord = require('discord.js'); const mongoose = require('mongoose'); -const UserData = require('../models/user'); +const UserData = require('../../models/user'); module.exports = { name: "dnd", @@ -34,7 +34,7 @@ module.exports = { let tempDate = new Date(); tu.statusclearat = tempDate.setHours(tempDate.getHours() + 12); tu.save(); - require('../util/cachestatus')(message.author.id, tempDate.setHours(tempDate.getHours() + 12)); + require('../../util/cachestatus')(message.author.id, tempDate.setHours(tempDate.getHours() + 12)); return message.reply(`I set your ${tu.statusclearmode === 'auto' ? 'automatically' : 'manually'}-clearing Do not Disturb message to: ${reason.trim()}`); } }; \ No newline at end of file diff --git a/commands/hug.js b/commands/social/hug.js similarity index 94% rename from commands/hug.js rename to commands/social/hug.js index 9b7446f..4a7d3ac 100644 --- a/commands/hug.js +++ b/commands/social/hug.js @@ -1,10 +1,10 @@ const Discord = require('discord.js'); -const Saves = require('../models/saves'); -const UserData = require('../models/user'); -const VC = require('../models/vscount'); +const Saves = require('../../models/saves'); +const UserData = require('../../models/user'); +const VC = require('../../models/vscount'); -const makeId = require('../util/makeid'); +const makeId = require('../../util/makeid'); module.exports = { name: "hug", diff --git a/commands/sip.js b/commands/social/sip.js similarity index 92% rename from commands/sip.js rename to commands/social/sip.js index 4ddd0c0..ee451b3 100644 --- a/commands/sip.js +++ b/commands/social/sip.js @@ -1,7 +1,7 @@ const Discord = require('discord.js'); -const Saves = require('../models/saves'); -const UserData = require('../models/user'); -const makeId = require('../util/makeid'); +const Saves = require('../../models/saves'); +const UserData = require('../../models/user'); +const makeId = require('../../util/makeid'); module.exports = { name: "sip", diff --git a/commands/starboard.js b/commands/social/starboard.js similarity index 98% rename from commands/starboard.js rename to commands/social/starboard.js index 2846603..c60b751 100644 --- a/commands/starboard.js +++ b/commands/social/starboard.js @@ -1,6 +1,6 @@ const Discord = require('discord.js'); -const GuildData = require('../models/guild'); -const ask = require('../util/ask'); +const GuildData = require('../../models/guild'); +const ask = require('../../util/ask'); module.exports = { name: "starboard", diff --git a/commands/randnum.js b/commands/utility/randnum.js similarity index 100% rename from commands/randnum.js rename to commands/utility/randnum.js diff --git a/handle/command.js b/handle/command.js index e1f39af..e122baf 100644 --- a/handle/command.js +++ b/handle/command.js @@ -4,7 +4,8 @@ const chalk = require('chalk'); //const ora = require('ora'); module.exports = client => { - var commands = fs.readdirSync('./commands').filter(file => file.endsWith('.js')); + let commands = fs.readdirSync('./commands').filter(file => file.endsWith('.js')); + fs.readdirSync('./commands').filter(file => !file.includes('.')).forEach(dir => fs.readdirSync(`./commands/${dir}`).filter(file => file.endsWith('.js')).forEach(x => commands.push(x))); //console.log(''); //let cora = ora(`${chalk.white("Loading commands into client.")} ${chalk.blue("[")}${chalk.blueBright("0")}${chalk.blue("/")}${chalk.blueBright(`${commands.length}`)}${chalk.blue("]")}`).start(); @@ -17,12 +18,12 @@ module.exports = client => { var command = require(`../commands/${commandf}`); client.commands.set(command.name, command); if (command.aliases) {command.aliases.forEach(a => client.aliases.set(a, command.name));} - console.log(`${chalk.gray('[LOG] ')} >> ${chalk.blueBright('Loaded Command')} ${chalk.white(command.name)} ${chalk.blueBright('with')} ${chalk.white(command.aliases && command.aliases.length ? command.aliases.length : 0)} ${chalk.blueBright('aliases')}`); + console.log(`${chalk.gray('[LOAD]')} >> ${chalk.blueBright('Loaded Command')} ${chalk.white(command.name)} ${chalk.blueBright('with')} ${chalk.white(command.aliases && command.aliases.length ? command.aliases.length : 0)} ${chalk.blueBright('aliases')}`); } /*cora.stop(); cora.clear(); console.log(`${chalk.gray('[BOOT]')} >> ${chalk.blue('Getting Commands...')}\n`); Array.from(client.commands.values()).forEach(command => { - console.log(`${chalk.gray('[LOG] ')} >> ${chalk.blueBright('Loaded Command')} ${chalk.white(command.name)} ${chalk.blueBright('with')} ${chalk.white(command.aliases && command.aliases.length ? command.aliases.length : 0)} ${chalk.blueBright('aliases')}`); + console.log(`${chalk.gray('[LOAD]')} >> ${chalk.blueBright('Loaded Command')} ${chalk.white(command.name)} ${chalk.blueBright('with')} ${chalk.white(command.aliases && command.aliases.length ? command.aliases.length : 0)} ${chalk.blueBright('aliases')}`); });*/ console.log(`\n${chalk.gray('[BOOT]')} >> ${chalk.blue('Loaded all Commands')}`); }; \ No newline at end of file diff --git a/handle/event.js b/handle/event.js index ead4b3c..aeea4ce 100644 --- a/handle/event.js +++ b/handle/event.js @@ -11,7 +11,7 @@ module.exports = client => { let evt = require('../events/' + file); client.removeAllListeners(evtName); client.on(evtName, evt.bind(null, client)); - console.log(`${chalk.gray('[LOG] ')} >> ${chalk.blueBright('Loaded Event')} ${chalk.white(evtName)}`); + console.log(`${chalk.gray('[LOAD]')} >> ${chalk.blueBright('Loaded Event')} ${chalk.white(evtName)}`); } console.log(`\n${chalk.gray('[BOOT]')} >> ${chalk.blue('Loaded all Events')}`); }; \ No newline at end of file diff --git a/handle/response.js b/handle/response.js index 1ad9f94..a8af7d7 100644 --- a/handle/response.js +++ b/handle/response.js @@ -10,7 +10,7 @@ module.exports = client => { var response = require(`../responses/${responsef}`); client.responses.triggers.push([response.name, response.condition]); client.responses.commands.set(response.name, response); - console.log(`${chalk.gray('[LOG] ')} >> ${chalk.blueBright('Loaded Response')} ${chalk.white(response.name)}`); + console.log(`${chalk.gray('[LOAD]')} >> ${chalk.blueBright('Loaded Response')} ${chalk.white(response.name)}`); } console.log(`\n${chalk.gray('[BOOT]')} >> ${chalk.blue('Loaded all Responses')}`); }; \ No newline at end of file diff --git a/util/cache.js b/util/cache.js index b892cdb..19c959c 100644 --- a/util/cache.js +++ b/util/cache.js @@ -22,5 +22,5 @@ module.exports = async (client) => { let ora_lrCache = ora("Caching Level Roles...").start(); await require('./cache/lr')(client); ora_lrCache.stop(); ora_lrCache.clear(); - console.log(`${chalk.gray('[PROC]')} >> ${chalk.blueBright(`Cached`)} ${chalk.white(`${client.misc.cache.lxp.enabled.length}`)} ${chalk.blueBright(`guilds with Level Roles enabled.`)}`); + console.log(`${chalk.gray('[PROC]')} >> ${chalk.blueBright(`Cached`)} ${chalk.white(`${client.misc.cache.lxp.hasLevelRoles.length}`)} ${chalk.blueBright(`guilds with Level Roles enabled.`)}`); }; \ No newline at end of file