-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathreload.js
33 lines (23 loc) · 992 Bytes
/
reload.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
25
26
27
28
29
30
31
32
33
const Discord = require("discord.js")
const botconfig = require("../config.json");
module.exports.run = async (bot, message, args) => {
if(message.author.id != "461959539114246175") return message.channel.send("You're not the bot the owner!")
if(!args[0]) return message.channel.send("Please provide a command to reload!")
let commandName = args[0].toLowerCase()
try {
delete require.cache[require.resolve(`./${commandName}.js`)] // usage !reload <name>
bot.commands.delete(commandName)
const pull = require(`./${commandName}.js`)
bot.commands.set(commandName, pull)
} catch(e) {
return message.channel.send(`Could not reload: \`${args[0].toUpperCase()}\``)
}
message.channel.send(`The command \`${args[0].toUpperCase()}\` has been reloaded!`)
}
module.exports.config = {
name: "reload",
description: "reloads a bot command!",
usage: "!reload",
accessableby: "Bot Owner",
aliases: ["creload"]
}