This repository has been archived by the owner on Oct 17, 2021. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
execute.js
24 lines (23 loc) · 1.64 KB
/
execute.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
const fs = require("mz/fs");
const d = require("discord.js");
module.exports.exec = function (command, subcommand, args, message, yakhi) {
fs.readdir(`./commands/${command}/`, (err, files) => {
if (err) {
console.log(err);
} else {
if (files.includes(subcommand + ".js")) {
require(`./commands/${command}/${subcommand}.js`).run(
args,
message,
yakhi
);
} else {
const toSend = new d.MessageEmbed()
.setColor("ff0000")
.setDescription("ERROR: Command not recognised.")
.setTitle(`Error`);
message.channel.send(toSend);
}
}
});
};