-- Redirect Bot by bastya_elvtars (the rock n' roll doctor)
-- written for 6Marilyn6Manson6
-- usual: cmds can be main or in PM
-- set if u want the bot in userlist or not
-- cmds can be customised
-- only MASTER profile can use it
-- based on channelbot 0.9h by Nathanos
-- Converted in LUA 5 by 6Marilyn6Manson6 at 06/05/2005
cmd1="!chred" -- changing default redir addy
cmd2="!setredirectall" -- setting redirect all newly coming users (on/off)
cmd3="!setredirectfull" -- setting redirect all when hub full (on/off)
Bot="RedirectBot" -- no need 2 explain
BotInUserList=1 -- set to 1 if u wanna see bot in userlist
function Main()
if BotInUserList==1 then
frmHub:RegBot(Bot)
end
end
-- dont edit below
function ChRed(user, data,env)
if user.iProfile==0 then
local _,_,newaddy=string.find(data,"%b<>%s+%S+%s+(%S+)")
if newaddy then
frmHub:SetRedirectAddress(newaddy)
SendToOps(Bot, user.sName.." changed the hub redirect address to: "..newaddy.." |")
user:SendData(parseenv(user,env,Bot).."You changed the hub redirect address to: "..newaddy.." |")
else
user:SendData(parseenv(user,env,Bot).. "It would be so nice to type the redirect address, don't you think? |")
end
else
user:SendData(parseenv(user,env,Bot).."You do not have sufficient rights to run that command! |")
end
end
function SetRedirectAll(user, data,env)
if user.iProfile==0 then
local _,_,arg=string.find(data,"%b<>%s+%S+%s+(%S+)")
if arg ~= nil then
if (arg=="on") then
frmHub:SetRedirectFull(0)
frmHub:SetRedirectAll(1)
SendToOps(Bot, user.sName.." changed the redirect all new connections to: "..arg.." |")
user:SendData(parseenv(user,env,Bot).."You changed the redirect all new connections to: "..arg.." |")
elseif (arg=="off") then
frmHub:SetRedirectAll(0)
SendToOps(Bot, user.sName.." changed the redirect all new connections to: "..arg.." |")
user:SendData(parseenv(user,env,Bot).."You changed the redirect all new connections to: "..arg.." |")
else
user:SendData(parseenv(user,env,Bot).."The value can only be: on or off. It cannot be "..arg.." |")
end
else
user:SendData(parseenv(user,env,Bot).. "Damn, don't be so lazy, type the switch after the comand too! |")
end
else
user:SendData(parseenv(user,env,Bot).."You do not have sufficient rights to run that command! |")
end
end
function SetRedirectFull(user, data,env)
if user.iProfile==0 then
local _,_,arg=string.find(data,"%b<>%s+%S+%s+(%S+)")
if arg ~= nil then
if (arg=="on") then
frmHub:SetRedirectAll(0)
frmHub:SetRedirectFull(1)
SendToOps(Bot, user.sName.." has enabled the redirect all new connections when maximum connections reached feature. |")
user:SendData(parseenv(user,env,Bot).."You have enabled the redirect all new connections when maximum connections reached feature.|")
elseif (arg=="off") then
frmHub:SetRedirectFull(0)
SendToOps(Bot, user.sName.." has disabled the redirect all new connections when maximum connections reached feature. |")
user:SendData(parseenv(user,env,Bot).."You have disabled the redirect all new connections when maximum connections reached feature.|")
else
user:SendData(parseenv(user,env,Bot).."The value can only be: on or off. It cannot be "..arg.." |")
end
else
user:SendData(parseenv(user,env,Bot).. "Damn, don't be so lazy, type the switch after the comand too! |")
end
else
user:SendData(parseenv(user,env,Bot).."You do not have sufficient rights to run that command! |")
end
end
function ChatArrival(user,data)
returndata=0
if string.sub(data, 1, 1) == "<" then
data=string.sub(data,1,string.len(data)-1)
local _,_,cmd = string.find(data,"%b<>%s+(%S+)")
if cmd then
returndata=parsecmds(user,data,string.lower(cmd),"MAIN")
end
elseif string.sub(data, 1, 4) == "$To:" then
data=string.sub(data,1,string.len(data)-1)
local _,_,whoTo = string.find(data,"$To:%s+(%S+)")
if (whoTo == Bot) then
local _,_,cmd = string.find(data,"$To:%s+%S+%s+From:%s+%S+%s+$%b<>%s+(%S+)")
cmd=string.lower(cmd)
returndata=parsecmds(user,data,cmd,"PM")
end
end return returndata
end
function parsecmds(user,data,cmd,env)
if cmd==cmd1 then
ChRed(user,data,env) returndata=1
elseif cmd==cmd2 then
SetRedirectAll(user,data,env) returndata=1
elseif cmd==cmd3 then
SetRedirectFull(user,data,env) returndata=1
end
return returndata
end
function parseenv(user,env,bot)
if env=="PM" then
return "$To: "..user.sName.." From: "..bot.." $<"..bot.."> "
elseif env=="MAIN" then
return "<"..bot.."> "
end
end
c ya
Now these strings have stayed replaced from:
if string.sub(data,1,1) == "<" then ---> function ChatArrival(user, data)
if string.sub(data,1,4) == "$To:" then ---> function ToArrival(user,data)
Hello, could it be possible to add the feature of redirecting by profile so you can redirect all but or Masters?
QuoteOriginally posted by 6Marilyn6Manson6
-- Redirect Bot by bastya_elvtars (the rock n' roll doctor)
-- written for 6Marilyn6Manson6
-- usual: cmds can be main or in PM
-- set if u want the bot in userlist or not
-- cmds can be customised
-- only MASTER profile can use it
-- based on channelbot 0.9h by Nathanos
-- Converted in LUA 5 by 6Marilyn6Manson6 at 06/05/2005
cmd1="!chred" -- changing default redir addy
cmd2="!setredirectall" -- setting redirect all newly coming users (on/off)
cmd3="!setredirectfull" -- setting redirect all when hub full (on/off)
Bot="RedirectBot" -- no need 2 explain
BotInUserList=1 -- set to 1 if u wanna see bot in userlist
function Main()
if BotInUserList==1 then
frmHub:RegBot(Bot)
end
end
-- dont edit below
function ChRed(user, data,env)
if user.iProfile==0 then
local _,_,newaddy=string.find(data,"%b<>%s+%S+%s+(%S+)")
if newaddy then
frmHub:SetRedirectAddress(newaddy)
SendToOps(Bot, user.sName.." changed the hub redirect address to: "..newaddy.." |")
user:SendData(parseenv(user,env,Bot).."You changed the hub redirect address to: "..newaddy.." |")
else
user:SendData(parseenv(user,env,Bot).. "It would be so nice to type the redirect address, don't you think? |")
end
else
user:SendData(parseenv(user,env,Bot).."You do not have sufficient rights to run that command! |")
end
end
function SetRedirectAll(user, data,env)
if user.iProfile==0 then
local _,_,arg=string.find(data,"%b<>%s+%S+%s+(%S+)")
if arg ~= nil then
if (arg=="on") then
frmHub:SetRedirectFull(0)
frmHub:SetRedirectAll(1)
SendToOps(Bot, user.sName.." changed the redirect all new connections to: "..arg.." |")
user:SendData(parseenv(user,env,Bot).."You changed the redirect all new connections to: "..arg.." |")
elseif (arg=="off") then
frmHub:SetRedirectAll(0)
SendToOps(Bot, user.sName.." changed the redirect all new connections to: "..arg.." |")
user:SendData(parseenv(user,env,Bot).."You changed the redirect all new connections to: "..arg.." |")
else
user:SendData(parseenv(user,env,Bot).."The value can only be: on or off. It cannot be "..arg.." |")
end
else
user:SendData(parseenv(user,env,Bot).. "Damn, don't be so lazy, type the switch after the comand too! |")
end
else
user:SendData(parseenv(user,env,Bot).."You do not have sufficient rights to run that command! |")
end
end
function SetRedirectFull(user, data,env)
if user.iProfile==0 then
local _,_,arg=string.find(data,"%b<>%s+%S+%s+(%S+)")
if arg ~= nil then
if (arg=="on") then
frmHub:SetRedirectAll(0)
frmHub:SetRedirectFull(1)
SendToOps(Bot, user.sName.." has enabled the redirect all new connections when maximum connections reached feature. |")
user:SendData(parseenv(user,env,Bot).."You have enabled the redirect all new connections when maximum connections reached feature.|")
elseif (arg=="off") then
frmHub:SetRedirectFull(0)
SendToOps(Bot, user.sName.." has disabled the redirect all new connections when maximum connections reached feature. |")
user:SendData(parseenv(user,env,Bot).."You have disabled the redirect all new connections when maximum connections reached feature.|")
else
user:SendData(parseenv(user,env,Bot).."The value can only be: on or off. It cannot be "..arg.." |")
end
else
user:SendData(parseenv(user,env,Bot).. "Damn, don't be so lazy, type the switch after the comand too! |")
end
else
user:SendData(parseenv(user,env,Bot).."You do not have sufficient rights to run that command! |")
end
end
function ChatArrival(user,data)
returndata=0
if string.sub(data, 1, 1) == "<" then
data=string.sub(data,1,string.len(data)-1)
local _,_,cmd = string.find(data,"%b<>%s+(%S+)")
if cmd then
returndata=parsecmds(user,data,string.lower(cmd),"MAIN")
end
elseif string.sub(data, 1, 4) == "$To:" then
data=string.sub(data,1,string.len(data)-1)
local _,_,whoTo = string.find(data,"$To:%s+(%S+)")
if (whoTo == Bot) then
local _,_,cmd = string.find(data,"$To:%s+%S+%s+From:%s+%S+%s+$%b<>%s+(%S+)")
cmd=string.lower(cmd)
returndata=parsecmds(user,data,cmd,"PM")
end
end return returndata
end
function parsecmds(user,data,cmd,env)
if cmd==cmd1 then
ChRed(user,data,env) returndata=1
elseif cmd==cmd2 then
SetRedirectAll(user,data,env) returndata=1
elseif cmd==cmd3 then
SetRedirectFull(user,data,env) returndata=1
end
return returndata
end
function parseenv(user,env,bot)
if env=="PM" then
return "$To: "..user.sName.." From: "..bot.." $<"..bot.."> "
elseif env=="MAIN" then
return "<"..bot.."> "
end
end
c ya
Hello folks :]
nice rd-bot ,,
why not let netowners use the commands - not only the owner/master inda hub
Best Regards
Well, the script is editable aka DO it yourself .
QuoteOriginally posted by Dessamator
Well, the script is editable aka DO it yourself .
Belive me - i have tried to solve it myself
i wouldnt ask if i did make it to work
function ChRed(user, data,env)
if user.iProfile==0 or 1 then
function ChRed(user, data,env)
if user.iProfile==0,1 then
just some changes i did test
if user.iProfile==0 or user.iProfile== 1
QuoteOriginally posted by bastya_elvtars
if user.iProfile==0 or user.iProfile== 1
it works :]
trying to learn something new every day
Thanks
Hello alles
a litle request:
a command for showing what rd-adress the hub has (!shred)
my netowners complains - they cannot see hubs rdadress =(
And can you add the function of redirecting all but OPs?