mirror of
https://github.com/DarthKilroy/Spot.git
synced 2025-12-23 04:06:49 +00:00
Remove unused code, clean up folder tree
This commit is contained in:
parent
a4892d854b
commit
1e8c1261f5
14 changed files with 38 additions and 80 deletions
8
bot.js
8
bot.js
|
|
@ -74,20 +74,20 @@ const botProcess = () => {
|
|||
|
||||
Command.init();
|
||||
|
||||
const help = require("./model/command/help");
|
||||
const help = require("./command/help");
|
||||
bot.ws.on('INTERACTION_CREATE', help.interactionHandler);
|
||||
|
||||
bot.on('ready', () => {
|
||||
fs.readdirSync('./event/bot/')
|
||||
fs.readdirSync('./event/')
|
||||
.filter(filename => filename.endsWith('.js'))
|
||||
.map(filename => filename.substr(0, filename.length - 3))
|
||||
.forEach(filename => {
|
||||
const event = filename.replace(/([_-][a-z])/gu, character => `${character.substr(1).toUpperCase()}`);
|
||||
|
||||
if (filename !== 'ready') {
|
||||
bot.on(event, require(`./event/bot/${filename}`));
|
||||
bot.on(event, require(`./event/${filename}`));
|
||||
} else {
|
||||
require(`./event/bot/${filename}`)();
|
||||
require(`./event/${filename}`)();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -1,18 +1,12 @@
|
|||
const Logger = require('@lilywonhalf/pretty-logger');
|
||||
const Discord = require('discord.js');
|
||||
const CommandCategory = require('../command-category');
|
||||
const CommandPermission = require('../command-permission');
|
||||
const Guild = require('../guild');
|
||||
const CommandCategory = require('../model/command-category');
|
||||
const CommandPermission = require('../model/command-permission');
|
||||
const Guild = require('../model/guild');
|
||||
|
||||
class Avatar
|
||||
{
|
||||
static instance = null;
|
||||
|
||||
constructor() {
|
||||
if (Avatar.instance !== null) {
|
||||
return Avatar.instance;
|
||||
}
|
||||
|
||||
this.aliases = ['av'];
|
||||
this.category = CommandCategory.FUN;
|
||||
this.isAllowedForContext = CommandPermission.yes;
|
||||
|
|
@ -1,20 +1,14 @@
|
|||
const Logger = require('@lilywonhalf/pretty-logger');
|
||||
const Config = require('../../config.json');
|
||||
const CommandCategory = require('../command-category');
|
||||
const CommandPermission = require('../command-permission');
|
||||
const { search } = require('../jira');
|
||||
const Config = require('../config.json');
|
||||
const CommandCategory = require('../model/command-category');
|
||||
const CommandPermission = require('../model/command-permission');
|
||||
const { search } = require('../model/jira');
|
||||
|
||||
const MAX_CHARACTERS = 1950;
|
||||
|
||||
class Changelog
|
||||
{
|
||||
static instance = null;
|
||||
|
||||
constructor() {
|
||||
if (Changelog.instance !== null) {
|
||||
return Changelog.instance;
|
||||
}
|
||||
|
||||
this.aliases = ['change-log', 'cl'];
|
||||
this.category = CommandCategory.MODERATION;
|
||||
this.isAllowedForContext = CommandPermission.isMemberMod;
|
||||
|
|
@ -1,17 +1,11 @@
|
|||
const Logger = require('@lilywonhalf/pretty-logger');
|
||||
const Config = require('../../config.json');
|
||||
const CommandCategory = require('../command-category');
|
||||
const CommandPermission = require('../command-permission');
|
||||
const Config = require('../config.json');
|
||||
const CommandCategory = require('../model/command-category');
|
||||
const CommandPermission = require('../model/command-permission');
|
||||
|
||||
class Clean
|
||||
{
|
||||
static instance = null;
|
||||
|
||||
constructor() {
|
||||
if (Clean.instance !== null) {
|
||||
return Clean.instance;
|
||||
}
|
||||
|
||||
this.aliases = ['clear', 'purge'];
|
||||
this.category = CommandCategory.MODERATION;
|
||||
this.isAllowedForContext = CommandPermission.isMemberMod;
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
const { MessageEmbed, Message } = require('discord.js');
|
||||
const CommandCategory = require('../command-category');
|
||||
const CommandPermission = require('../command-permission');
|
||||
const CommandCategory = require('../model/command-category');
|
||||
const CommandPermission = require('../model/command-permission');
|
||||
|
||||
const RGB_REGEX = /(\d{1,3})\D*,\D*(\d{1,3})\D*,\D*(\d{1,3})\D*/u;
|
||||
|
||||
|
|
@ -1,23 +1,17 @@
|
|||
const Discord = require('discord.js');
|
||||
const Logger = require('@lilywonhalf/pretty-logger');
|
||||
const Config = require('../../config.json');
|
||||
const CommandCategory = require('../command-category');
|
||||
const CommandPermission = require('../command-permission');
|
||||
const Config = require('../config.json');
|
||||
const CommandCategory = require('../model/command-category');
|
||||
const CommandPermission = require('../model/command-permission');
|
||||
|
||||
// Including every model here so that it's ready to be used by the command
|
||||
const Guild = require('../guild');
|
||||
const Guild = require('../model/guild');
|
||||
|
||||
const JAVASCRIPT_LOGO_URL = 'https://i.discord.fr/IEV8.png';
|
||||
|
||||
class Eval
|
||||
{
|
||||
static instance = null;
|
||||
|
||||
constructor() {
|
||||
if (Eval.instance !== null) {
|
||||
return Eval.instance;
|
||||
}
|
||||
|
||||
this.aliases = [];
|
||||
this.category = CommandCategory.BOT_MANAGEMENT;
|
||||
this.isAllowedForContext = CommandPermission.isMommy;
|
||||
|
|
@ -1,8 +1,8 @@
|
|||
const CommandPermission = require('../command-permission');
|
||||
const CommandCategory = require('../command-category');
|
||||
const CommandPermission = require('../model/command-permission');
|
||||
const CommandCategory = require('../model/command-category');
|
||||
|
||||
const commands = require('../command').commandList;
|
||||
const messages = require('../messages');
|
||||
const commands = require('../model/command').commandList;
|
||||
const messages = require('../model/messages');
|
||||
|
||||
const cachelessRequire = (path) => {
|
||||
if (!typeof path === 'string') {
|
||||
|
|
@ -73,7 +73,7 @@ const categoryPage = (cat, id, direct = false) => {
|
|||
data.embeds[0].fields = messages.getList();
|
||||
else
|
||||
data.embeds[0].fields = Array.from(commands.keys()).map(x => {
|
||||
const cmd = cachelessRequire(commands.get(x).split("command/").join(""));
|
||||
const cmd = cachelessRequire(commands.get(x));
|
||||
if (cleanString(cmd.category)?.toLowerCase() != cat.toLowerCase()) return;
|
||||
return { name: x, value: cmd.description ?? "No description."};
|
||||
}).filter(x => x);
|
||||
|
|
@ -1,17 +1,11 @@
|
|||
const Logger = require('@lilywonhalf/pretty-logger');
|
||||
const Config = require('../../config.json');
|
||||
const CommandCategory = require('../command-category');
|
||||
const CommandPermission = require('../command-permission');
|
||||
const Config = require('../config.json');
|
||||
const CommandCategory = require('../model/command-category');
|
||||
const CommandPermission = require('../model/command-permission');
|
||||
|
||||
class Kill
|
||||
{
|
||||
static instance = null;
|
||||
|
||||
constructor() {
|
||||
if (Kill.instance !== null) {
|
||||
return Kill.instance;
|
||||
}
|
||||
|
||||
this.aliases = [];
|
||||
this.category = CommandCategory.BOT_MANAGEMENT;
|
||||
this.isAllowedForContext = CommandPermission.isMemberMod;
|
||||
|
|
@ -1,16 +1,10 @@
|
|||
const Logger = require('@lilywonhalf/pretty-logger');
|
||||
const CommandCategory = require('../command-category');
|
||||
const CommandPermission = require('../command-permission');
|
||||
const CommandCategory = require('../model/command-category');
|
||||
const CommandPermission = require('../model/command-permission');
|
||||
|
||||
class Reload
|
||||
{
|
||||
static instance = null;
|
||||
|
||||
constructor() {
|
||||
if (Reload.instance !== null) {
|
||||
return Reload.instance;
|
||||
}
|
||||
|
||||
this.aliases = ['reboot'];
|
||||
this.category = CommandCategory.BOT_MANAGEMENT;
|
||||
this.isAllowedForContext = CommandPermission.isMemberMod;
|
||||
|
|
@ -1,16 +1,10 @@
|
|||
const Logger = require('@lilywonhalf/pretty-logger');
|
||||
const CommandCategory = require('../command-category');
|
||||
const CommandPermission = require('../command-permission');
|
||||
const CommandCategory = require('../model/command-category');
|
||||
const CommandPermission = require('../model/command-permission');
|
||||
|
||||
class SetAvatar
|
||||
{
|
||||
static instance = null;
|
||||
|
||||
constructor() {
|
||||
if (SetAvatar.instance !== null) {
|
||||
return SetAvatar.instance;
|
||||
}
|
||||
|
||||
this.aliases = ['setavatar'];
|
||||
this.category = CommandCategory.BOT_MANAGEMENT;
|
||||
this.isAllowedForContext = CommandPermission.isMemberMod;
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
const Guild = require('../../model/guild');
|
||||
const Guild = require('../model/guild');
|
||||
|
||||
module.exports = async (member) => {
|
||||
if ((member.guild === null || isRightGuild(member.guild.id)) && !member.user.bot) {
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
const Command = require('../../model/command');
|
||||
const Command = require('../model/command');
|
||||
|
||||
/**
|
||||
* @param {Message} message
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
const Logger = require('@lilywonhalf/pretty-logger');
|
||||
const Config = require('../../config.json');
|
||||
const Guild = require('../../model/guild');
|
||||
const Config = require('../config.json');
|
||||
const Guild = require('../model/guild');
|
||||
|
||||
module.exports = async () => {
|
||||
Logger.info('Logged in as ' + bot.user.username + '#' + bot.user.discriminator);
|
||||
|
|
@ -21,9 +21,9 @@ const Command = {
|
|||
Command.commandList = new Discord.Collection();
|
||||
Command.commandAliases = {};
|
||||
|
||||
fs.readdirSync('model/command/').forEach(file => {
|
||||
fs.readdirSync('command/').forEach(file => {
|
||||
if (file.substr(file.lastIndexOf('.')).toLowerCase() === '.js') {
|
||||
const commandPath = `./command/${file}`;
|
||||
const commandPath = `../command/${file}`;
|
||||
const commandInstance = cachelessRequire(commandPath);
|
||||
|
||||
if (commandInstance !== null) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue