reload
This commit is contained in:
parent
9a9bd56b7d
commit
5dee01b07b
2 changed files with 19 additions and 0 deletions
|
@ -3,6 +3,7 @@ return {
|
|||
owner = 935626920 , -- hehe
|
||||
cmds = {
|
||||
'eval',
|
||||
'reload',
|
||||
'ping',
|
||||
'rub',
|
||||
'start',
|
||||
|
@ -10,6 +11,7 @@ return {
|
|||
events = {
|
||||
'command',
|
||||
'ready',
|
||||
'inlineQuery',
|
||||
},
|
||||
parts = {
|
||||
'locale',
|
||||
|
|
17
src/cmds/reload.lua
Normal file
17
src/cmds/reload.lua
Normal file
|
@ -0,0 +1,17 @@
|
|||
return {
|
||||
private = true,
|
||||
run = function(C, msg)
|
||||
local cat, sub = table.unpack(msg.args)
|
||||
if not (cat and sub) then
|
||||
return C.api:reply(msg, '/reload cmds ping')
|
||||
end
|
||||
|
||||
local path = 'src.'..cat..'.'..sub
|
||||
package.loaded[path] = nil
|
||||
local err, m = pcall(require, path)
|
||||
C.api:reply(msg, ('Reloaded. %s (%s)'):format(
|
||||
err and 'Error:' or 'No errors',
|
||||
m
|
||||
))
|
||||
end
|
||||
}
|
Loading…
Reference in a new issue