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