--[[ cmd_errors.lua v0.01 by blastbeat - this script adds a command "errors" to get hub errors - usage: [+!#]errors ]]-- --// settings begin //-- local permission = { -- who is allowed to use this command? [ 0 ] = false, -- unreg [ 10 ] = false, -- guest [ 20 ] = false, -- reg [ 30 ] = false, -- vip [ 40 ] = true, -- svip [ 60 ] = true, -- operator [ 80 ] = true, -- admin [ 100 ] = true, -- hubowner } local msg_denied = "You are not allowed to use this command." local cmd = "errors" --// settings end //-- local utf_match = utf.match local path = "log/error.log" hub:setListener( "onStart", { }, function( ) local help = hub.import "cmd_help" if help then help.reg( "errors", "[+!#]errors", "sends error.log in pm", 40 ) end return nil end ) hub:setListener( "onBroadcast", { }, function( user, adccmd, txt ) local command, parameters = utf_match( txt, "^[+!#](%a+) ?(.*)" ) if command == cmd then if not permission[ user:getLevel( ) ] then user:reply( msg_denied, hub.getbot( ) ) return PROCESSED end local log local file, err = io.open( path, "r" ) if file then log = file:read( "*a" ) file:close( ) end user:reply( log, hub.getbot( ), hub.getbot( ) ) return PROCESSED end return nil end ) hub.debug( "** Loaded cmd_errors.lua **" )