added p/eulogy and the capability for command arguments
This commit is contained in:
parent
ea46fb8467
commit
ae2eb50b9c
3 changed files with 27 additions and 12 deletions
|
@ -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;
|
||||
|
||||
module.exports.execute = function (message, client) {
|
||||
|
@ -27,17 +37,13 @@ module.exports.execute = function (message, client) {
|
|||
);
|
||||
}
|
||||
if (!message.content.startsWith(prefix)) return;
|
||||
const args = message.content.slice(prefix.length).split(/ +/);
|
||||
const command = args.shift().toLowerCase();
|
||||
|
||||
/*if (message.channelId !== "1148814162273763418") {
|
||||
let text = "commands only work in <#1148814162273763418>";
|
||||
if (!client.commands.has(command)) {
|
||||
text += ", also thats not a command lmao";
|
||||
}
|
||||
message.reply(text);
|
||||
return;
|
||||
}*/
|
||||
const command = message.content
|
||||
.slice(prefix.length)
|
||||
.split(/ +/)
|
||||
.shift()
|
||||
.toLowerCase();
|
||||
const args = parseargs(message.content.slice(prefix.length + command.length));
|
||||
|
||||
if (!commands.has(command)) {
|
||||
message.reply("idiot thats not a command");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue