Redirect Bot
 

News:

29 December 2022 - PtokaX 0.5.3.0 (20th anniversary edition) released...
11 April 2017 - PtokaX 0.5.2.2 released...
8 April 2015 Anti child and anti pedo pr0n scripts are not allowed anymore on this board!
28 September 2015 - PtokaX 0.5.2.1 for Windows 10 IoT released...
3 September 2015 - PtokaX 0.5.2.1 released...
16 August 2015 - PtokaX 0.5.2.0 released...
1 August 2015 - Crowdfunding for ADC protocol support in PtokaX ended. Clearly nobody want ADC support...
30 June 2015 - PtokaX 0.5.1.0 released...
30 April 2015 Crowdfunding for ADC protocol support in PtokaX
26 April 2015 New support hub!
20 February 2015 - PtokaX 0.5.0.3 released...
13 April 2014 - PtokaX 0.5.0.2 released...
23 March 2014 - PtokaX testing version 0.5.0.1 build 454 is available.
04 March 2014 - PtokaX.org sites were temporary down because of DDOS attacks and issues with hosting service provider.

Main Menu

Redirect Bot

Started by 6Marilyn6Manson6, 06 May, 2005, 15:04:56

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

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

DorianG

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)

gOOfus

Hello, could it be possible to add the feature of redirecting by profile so you can redirect all but or Masters?

BeeR

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
A cold BeeR is stunning !!

Dessamator

Well, the script is editable aka DO it yourself .
Ignorance is Bliss.

BeeR

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
A cold BeeR is stunning !!

bastya_elvtars

if user.iProfile==0 or user.iProfile== 1
Everything could have been anything else and it would have just as much meaning.

BeeR

QuoteOriginally posted by bastya_elvtars
if user.iProfile==0 or user.iProfile== 1

it works :]
trying to learn something new every day

Thanks
A cold BeeR is stunning !!

BeeR

Hello alles

a litle request:

a command for showing what rd-adress the hub has (!shred)
my netowners complains - they cannot see hubs rdadress =(
A cold BeeR is stunning !!

gOOfus

And can you add the function of redirecting all but OPs?

SMF spam blocked by CleanTalk