Remove unnecessary function calls now that classes exist
This commit is contained in:
parent
00df6074d6
commit
ecbfc2bc2a
@ -19,16 +19,16 @@ module.exports = {
|
|||||||
for (const [key, value] of dotCommands) {
|
for (const [key, value] of dotCommands) {
|
||||||
if (key === this.command) {
|
if (key === this.command) {
|
||||||
this.isValid = true;
|
this.isValid = true;
|
||||||
return this.isValid;
|
return this;
|
||||||
} else if (value.alias && value.alias.includes(this.command)) {
|
} else if (value.alias && value.alias.includes(this.command)) {
|
||||||
this.command = key;
|
this.command = key;
|
||||||
this.isValid = true;
|
this.isValid = true;
|
||||||
return this.isValid;
|
return this;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
this.isValid = validCommands.includes(this.command);
|
this.isValid = validCommands.includes(this.command);
|
||||||
return this.isValid;
|
return this;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
GifData: class {
|
GifData: class {
|
||||||
|
@ -171,14 +171,6 @@ const functions = {
|
|||||||
if (isDev) console.log('Medical Advice Collection Built');
|
if (isDev) console.log('Medical Advice Collection Built');
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
dot: {
|
|
||||||
getCommandData(message) {
|
|
||||||
const commandData = new CommandData(message);
|
|
||||||
const { validCommands } = require('./config.json');
|
|
||||||
commandData.validate(message.client.dotCommands);
|
|
||||||
return commandData;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
embeds: {
|
embeds: {
|
||||||
help(interaction) {
|
help(interaction) {
|
||||||
// Construct the Help Embed
|
// Construct the Help Embed
|
||||||
|
4
main.js
4
main.js
@ -27,7 +27,7 @@ const { MessageActionRow, MessageButton } = require('discord.js');
|
|||||||
const fn = require('./functions.js');
|
const fn = require('./functions.js');
|
||||||
const config = require('./config.json');
|
const config = require('./config.json');
|
||||||
const strings = require('./strings.json');
|
const strings = require('./strings.json');
|
||||||
const { GifData } = require('./CustomModules/NodBot.js');
|
const { GifData, CommandData } = require('./CustomModules/NodBot.js');
|
||||||
const isDev = process.env.isDev;
|
const isDev = process.env.isDev;
|
||||||
|
|
||||||
client.once('ready', async () => {
|
client.once('ready', async () => {
|
||||||
@ -232,7 +232,7 @@ client.on('messageCreate', message => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
// Break the message down into its components and analyze it
|
// Break the message down into its components and analyze it
|
||||||
const commandData = fn.dot.getCommandData(message);
|
const commandData = new CommandData(message).validate(message.client.dotCommands);
|
||||||
console.log(commandData);
|
console.log(commandData);
|
||||||
|
|
||||||
if (commandData.isValid && commandData.isCommand) {
|
if (commandData.isValid && commandData.isCommand) {
|
||||||
|
Loading…
Reference in New Issue
Block a user