--[[ cmd_delreg.lua v0.01 by blastbeat - this script adds a command "delreg" to delreg users by nick or cid - usage: [+!#]delreg nick|cid | ]]-- --// settings begin //-- local permission = { [ 100 ] = true, -- hubowner } local cmd_options = { nick = "nick", cid = "cid", } local msg_denied = "You are not allowed to use this command." local msg_usage = "Usage: [+!#]delreg nick|cid |" local msg_error = "An error occured: " local msg_ok = "User delregged." local cmd = "delreg" --// settings end //-- local utf_match = utf.match hub:setListener( "onStart", { }, function( ) local help = hub.import "cmd_help" if help then help.reg( "delreg", "[+!#]delreg nick|cid |", "delregs a new user by nick or cid", 100 ) end return nil end ) hub:setListener( "onBroadcast", { }, function( user, adccmd, txt ) local command, parameters = utf_match( txt, "^[+!#](%a+) ?(.*)" ) if command == cmd then local user_level = user:getLevel( ) if not permission[ user_level ] then user:reply( msg_denied, hub.getbot( ) ) return PROCESSED end local option, arg = utf.match( parameters, "^(%S+) (.*)" ) if not ( option and arg ) or not cmd_options[ option ] then user:reply( msg_usage, hub.getbot( ) ) return PROCESSED end local target, bol, err = nil, nil, "unknown" if option == "nick" then target = hub.isnickonline( arg ) if target then arg = target:getFirstNick( ) end bol, err = hub.delreguser( arg ) else target = hub.iscidonline( arg ) bol, err = hub.delreguser( nil, arg ) end if not bol then user:reply( msg_error .. err, hub.getbot( ) ) else if target then target:kill( "ISTA 230 " .. "You\\swere\\sdelregged.\n" ) end user:reply( msg_ok ) end return PROCESSED end return nil end ) hub.debug( "** Loaded cmd_delreg.lua **" )