add -off in reload
This commit is contained in:
parent
0b2a7ac8e5
commit
5a54bc1032
1 changed files with 11 additions and 8 deletions
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
private: true
|
private: true
|
||||||
run: (msg) =>
|
run: (msg) =>
|
||||||
cat, sub = table.unpack msg.args
|
cat, sub, arg = table.unpack msg.args
|
||||||
if not (cat and sub)
|
if not (cat and sub)
|
||||||
return @api\reply msg, '/reload cmds ping'
|
return @api\reply msg, '/reload cmds ping'
|
||||||
|
|
||||||
|
@ -10,14 +10,17 @@
|
||||||
@api\off package.loaded[path]
|
@api\off package.loaded[path]
|
||||||
package.loaded[path] = nil
|
package.loaded[path] = nil
|
||||||
|
|
||||||
suc, m = pcall require, path
|
if arg == '-off'
|
||||||
|
@api\reply msg, 'Turned off'
|
||||||
|
|
||||||
if not suc then return @api\reply msg, 'Reload failed. '.. m
|
else
|
||||||
else switch cat
|
suc, m = pcall require, path
|
||||||
|
if not suc then return @api\reply msg, "Reload failed. #{m}"
|
||||||
|
switch cat
|
||||||
when 'events' then @api\on sub, m
|
when 'events' then @api\on sub, m
|
||||||
when 'cmds' then @cmds[sub] = m
|
when 'cmds' then @cmds[sub] = m
|
||||||
when 'parts' then m @
|
else m @
|
||||||
|
|
||||||
@api\reply msg, "Reloaded. #{m}"
|
@api\reply msg, "Reloaded. #{m}"
|
||||||
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue