added p/eulogy and the capability for command arguments

This commit is contained in:
ayeuhugyu 2023-09-21 18:16:05 -07:00
parent ea46fb8467
commit ae2eb50b9c
3 changed files with 27 additions and 12 deletions

View file

@ -17,6 +17,10 @@ clean up p/vileimagery, its horrendous
**_Note:_** _versions before this were not uploaded to the repo, this is not the first version._ **_Note:_** _versions before this were not uploaded to the repo, this is not the first version._
1.9 - added p/eulogy and the capability for command arguments
---
1.8 - reorganized files some more, moved all events from index.js to seperate scripts in events folder, 1.8 - reorganized files some more, moved all events from index.js to seperate scripts in events folder,
1.8.1 - cleaned up p/vileimagery a bit 1.8.1 - cleaned up p/vileimagery a bit
1.8.2 - fixed guildMemberAdd event error 1.8.2 - fixed guildMemberAdd event error

View file

@ -4,7 +4,12 @@ module.exports = {
name: "test", name: "test",
description: "test command", description: "test command",
execute(message, args) { execute(message, args) {
log("failed.log", message, __filename, "test command"); let text =
message.reply("log test completed, don't contact me again"); "command arguments test \nthis list should include all arguments you included in the command \n";
for (let i = 0; i < args.length; i++) {
text += args[i] + "\n";
}
message.reply(text);
}, },
}; };

View file

@ -15,6 +15,16 @@ for (const file of commandFiles) {
})(); })();
} }
function parseargs(string) {
const args = string.split(" ");
for (let i = 0; i < args.length; i++) {
if (args[i] === "") {
args.splice(i, 1);
}
}
return args;
}
const prefix = process.env.PREFIX; const prefix = process.env.PREFIX;
module.exports.execute = function (message, client) { module.exports.execute = function (message, client) {
@ -27,17 +37,13 @@ module.exports.execute = function (message, client) {
); );
} }
if (!message.content.startsWith(prefix)) return; if (!message.content.startsWith(prefix)) return;
const args = message.content.slice(prefix.length).split(/ +/);
const command = args.shift().toLowerCase();
/*if (message.channelId !== "1148814162273763418") { const command = message.content
let text = "commands only work in <#1148814162273763418>"; .slice(prefix.length)
if (!client.commands.has(command)) { .split(/ +/)
text += ", also thats not a command lmao"; .shift()
} .toLowerCase();
message.reply(text); const args = parseargs(message.content.slice(prefix.length + command.length));
return;
}*/
if (!commands.has(command)) { if (!commands.has(command)) {
message.reply("idiot thats not a command"); message.reply("idiot thats not a command");