v3.3.3: Paged Commands #20

Merged
voidf1sh merged 15 commits from v3.3.3 into main 2024-09-26 13:24:55 +00:00
2 changed files with 29 additions and 13 deletions
Showing only changes of commit 00df6074d6 - Show all commits

View File

@ -3,18 +3,32 @@ module.exports = {
constructor(message) {
// Get the location of the final period in the message
this.finalPeriod = message.content.lastIndexOf('.');
this.isCommand = finalPeriod >= 0 ? true : false; // Check if there is a period somewhere in the message to flag as a possible command
this.args = message.content.slice(0,finalPeriod).toLowerCase(); // Grab everything leading up to the final period
this.command = message.content.slice(finalPeriod + 1).toLowerCase(); // Grab everything after the final period
this.isCommand = this.finalPeriod >= 0 ? true : false; // Check if there is a period somewhere in the message to flag as a possible command
this.isValid = false;
this.args = message.content.slice(0,this.finalPeriod).toLowerCase(); // Grab everything leading up to the final period
this.command = message.content.slice(this.finalPeriod + 1).toLowerCase(); // Grab everything after the final period
this.author = message.author.username;
return this;
}
isValid(validCommands) {
validate(dotCommands) {
if (this.args.startsWith('http')) return false;
if (this.args.startsWith('www')) return false;
return validCommands.includes(this.command);
for (const [key, value] of dotCommands) {
if (key === this.command) {
this.isValid = true;
return this.isValid;
} else if (value.alias && value.alias.includes(this.command)) {
this.command = key;
this.isValid = true;
return this.isValid;
}
}
this.isValid = validCommands.includes(this.command);
return this.isValid;
}
},
GifData: class {

View File

@ -82,13 +82,13 @@ const functions = {
for (const file of dotCommandFiles) {
const dotCommand = require(`./dot-commands/${file}`);
client.dotCommands.set(dotCommand.name, dotCommand);
if (Array.isArray(dotCommand.alias)) {
dotCommand.alias.forEach(element => {
client.dotCommands.set(element, dotCommand);
});
} else if (dotCommand.alias != undefined) {
client.dotCommands.set(dotCommand.alias, dotCommand);
}
// if (Array.isArray(dotCommand.alias)) {
// dotCommand.alias.forEach(element => {
// client.dotCommands.set(element, dotCommand);
// });
// } else if (dotCommand.alias != undefined) {
// client.dotCommands.set(dotCommand.alias, dotCommand);
// }
}
if (isDev) console.log('Dot Commands Collection Built');
},
@ -174,7 +174,9 @@ const functions = {
dot: {
getCommandData(message) {
const commandData = new CommandData(message);
return commandData.isValid(require('./config.json').validCommands);
const { validCommands } = require('./config.json');
commandData.validate(message.client.dotCommands);
return commandData;
}
},
embeds: {