remove unneeded functions
This commit is contained in:
parent
a32079a4f0
commit
ac967fc98e
1 changed files with 0 additions and 62 deletions
|
@ -76,68 +76,6 @@ module.exports = (client) => {
|
||||||
return `Unable to load command ${commandName}: ${e}`;
|
return `Unable to load command ${commandName}: ${e}`;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
client.unloadCommand = async (commandName) => {
|
|
||||||
let command;
|
|
||||||
if (client.commands.has(commandName)) {
|
|
||||||
command = client.commands.get(commandName);
|
|
||||||
} else if (client.aliases.has(commandName)) {
|
|
||||||
command = client.commands.get(client.aliases.get(commandName));
|
|
||||||
}
|
|
||||||
if (!command) return `The command \`${commandName}\` doesn\'t seem to exist, nor is it an alias. Try again!`;
|
|
||||||
|
|
||||||
if (command.shutdown) {
|
|
||||||
await command.shutdown(client);
|
|
||||||
}
|
|
||||||
const mod = require.cache[require.resolve(`../commands/${command.help.category}/${command.help.name}`)];
|
|
||||||
delete require.cache[require.resolve(`../commands/${command.help.category}/${command.help.name}.js`)];
|
|
||||||
for (let i = 0; i < mod.parent.children.length; i++) {
|
|
||||||
if (mod.parent.children[i] === mod) {
|
|
||||||
mod.parent.children.splice(i, 1);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
};
|
|
||||||
|
|
||||||
client.reloadCommand = async(commandName) => {
|
|
||||||
// step 1: unload the command
|
|
||||||
let command;
|
|
||||||
if (client.commands.has(commandName)) {
|
|
||||||
command = client.commands.get(commandName);
|
|
||||||
} else if (client.aliases.has(commandName)) {
|
|
||||||
command = client.commands.get(client.aliases.get(commandName));
|
|
||||||
}
|
|
||||||
if (!command) return `The command \`${commandName}\` doesn\'t seem to exist, nor is it an alias. Try again!`;
|
|
||||||
|
|
||||||
if (command.shutdown) {
|
|
||||||
await command.shutdown(client);
|
|
||||||
}
|
|
||||||
const mod = require.cache[require.resolve(`../commands/${command.help.category}/${commandName}.js`)];
|
|
||||||
delete require.cache[require.resolve(`../commands/${command.help.category}/${commandName}.js`)];
|
|
||||||
for (let i = 0; i < mod.parent.children.length; i++) {
|
|
||||||
if (mod.parent.children[i] === mod) {
|
|
||||||
mod.parent.children.splice(i, 1);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
|
|
||||||
// step 2: load said command
|
|
||||||
try {
|
|
||||||
const props = require(`../commands/${command.help.category}/${command.Name}`);
|
|
||||||
if (props.init) {
|
|
||||||
props.init(client);
|
|
||||||
}
|
|
||||||
client.commands.set(props.help.name, props);
|
|
||||||
props.conf.aliases.forEach(alias => {
|
|
||||||
client.aliases.set(alias, props.help.name);
|
|
||||||
});
|
|
||||||
return false;
|
|
||||||
} catch (e) {
|
|
||||||
return `Unable to load command ${commandName}: ${e}`;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Object.defineProperty(String.prototype, "toProperCase", {
|
Object.defineProperty(String.prototype, "toProperCase", {
|
||||||
value: function() {
|
value: function() {
|
||||||
|
|
Loading…
Reference in a new issue