--[[ cmd_reloadcfg.lua v0.02 by blastbeat - this script adds a command "reloadcfg" to reload cfg and user db - usage: [+!#]reloadcfg - changelog 0.02: - updated script api ]]-- --// settings begin //-- local permission = { -- who is allowed to use this command? [ 0 ] = false, -- unreg [ 10 ] = false, -- guest [ 20 ] = false, -- reg [ 30 ] = false, -- vip [ 40 ] = false, -- svip [ 60 ] = false, -- operator [ 80 ] = true, -- admin [ 100 ] = true, -- hubowner } local msg_denied = "You are not allowed to use this command." local msg_ok = "Config reloaded." local cmd = "reloadcfg" --// settings end //-- local utf_match = utf.match hub:setListener( "onStart", { }, function( ) local help = hub.import "cmd_help" if help then help.reg( "reloadcfg", "[+!#]reloadcfg", "reloads the cfg.tbl", 80 ) end return nil end ) hub:setListener( "onBroadcast", { }, function( user, adccmd, txt ) local command = utf_match( txt, "^[+!#](%a+)" ) if command == cmd then if not permission[ user:getLevel( ) ] then user:reply( msg_denied, hub.getbot( ) ) return PROCESSED end hub.reloadcfg( ) hub.reloadusers( ) user:reply( msg_ok, hub.getbot( ) ) return PROCESSED end return nil end ) hub.debug( "** Loaded cmd_reloadcfg.lua **" )