reordered functions

This commit is contained in:
Emily 2020-04-22 22:57:22 +10:00
parent c968292338
commit 6ea766ed1d

View file

@ -152,25 +152,6 @@ module.exports = client => {
return role return role
} }
// Loads commands
client.loadCommand = (commandName) => {
try {
const props = require(`../commands/${commandName}`)
if (props.init) {
props.init(client)
}
client.commands.set(props.help.name, props)
// So commands can each have their own cooldown time
client.cooldown.set(props.help.name, new Map())
props.conf.aliases.forEach(alias => {
client.aliases.set(alias, props.help.name)
})
return false
} catch (e) {
return `Failed to load ${commandName}: ${e}`
}
}
// Permission level function // Permission level function
client.permlevel = (message, settings) => { client.permlevel = (message, settings) => {
let permlvl = 0 let permlvl = 0
@ -256,6 +237,25 @@ module.exports = client => {
} }
} }
// Loads commands
client.loadCommand = (commandName) => {
try {
const props = require(`../commands/${commandName}`)
if (props.init) {
props.init(client)
}
client.commands.set(props.help.name, props)
// So commands can each have their own cooldown time
client.cooldown.set(props.help.name, new Map())
props.conf.aliases.forEach(alias => {
client.aliases.set(alias, props.help.name)
})
return false
} catch (e) {
return `Failed to load ${commandName}: ${e}`
}
}
// Command unloader // Command unloader
client.unloadCommand = async (commandName) => { client.unloadCommand = async (commandName) => {
let command let command