Fix In AwayBoT
 

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

Fix In AwayBoT

Started by D-J Valhala, 24 May, 2004, 10:40:43

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

D-J Valhala

whan user is away if he get PM the Dude Who PM him get the away MSG after each MSG can you change it to be 1 time and like that
DJ-Valhala Is Away : Away MSG
and after it wont show the msg if the user talk to him
10x :D

BotName = "-=<[LsD_-_BoT]>=-"

awayArray={}

function DataArrival(user, data)

if( strsub(data, 1, 1) == "<" ) then

-- remove pipe at the end

data=strsub(data,1,strlen(data)-1)

s,e,cmd,arg = strfind( data, "%b<>%s+(%S+)%s+(.*)" )

if (arg==nil) then

s,e,cmd = strfind( data, "%b<>%s+(%S+)%s*" )

end

if (cmd=="+away") then

if (not (arg)) then
arg = "I'm away. I might answer later if you're lucky."
end

SendToAll(BotName,date(""..user.sName.." Is now away because: ")..arg.."")

awayArray[user.sName]=arg

end

if (cmd=="+back") then

if (awayArray[user.sName]==nil) then

else

SendToAll(BotName,date(""..user.sName.." is back again..."))

awayArray[user.sName]=nil

end

end

end

if(strsub(data, 1, 4) == "$To:") then

-- remove end pipe

data=strsub(data,1,strlen(data)-1)

-- is this meant for an away user?

s,e,whoTo = strfind(data,"$To:%s+(%S+)")

if (awayArray[whoTo] == nil) then

--user is not away

else

user:SendPM(whoTo,"Away Message: "..awayArray[whoTo])

end

end

end
My PsyIsrael Network
==================
--=[PsyIsrael DC Hub]=--
--=[PsyIsrael Website]=--
==================

Corayzon

#1
hey dude!

um, i wont even read through this cause its all on the margin...its to hard to read!

when posting scripts please put them within the following context, [*code][*/code], or [*php][*/php]

this enables the text to have tab chars which make life so easy when editing and debuging script!

note :: dont add the * char to code and /code

thankz

D-J Valhala

#2
whan user is away if he get PM the Dude Who PM him get the away MSG after each MSG can you change it to be 1 time and like that
DJ-Valhala Is Away : Away MSG
and after it wont show the msg if the user talk to him
and can you add is user is away he can't so anothere away like +away MSG
You Allready In Away Mode!
and if back and no in away mode
+back
You are not in away mode!
10x alot!!! :)

BotName = "-=<[LsD_-_BoT]>=-" 

awayArray={} 

function DataArrival(user, data) 

if( strsub(data, 1, 1) == "<" ) then 

-- remove pipe at the end 

data=strsub(data,1,strlen(data)-1) 

s,e,cmd,arg = strfind( data, "%b<>%s+(%S+)%s+(.*)" ) 

if (arg==nil) then 

s,e,cmd = strfind( data, "%b<>%s+(%S+)%s*" ) 

end 

if (cmd=="+away") then 

if (not (arg)) then 
arg = "I'm away. I might answer later if you're lucky." 
end 

SendToAll(BotName,date(""..user.sName.." Is now away because: ")..arg.."") 

awayArray[user.sName]=arg 

end 

if (cmd=="+back") then 

if (awayArray[user.sName]==nil) then 

else 

SendToAll(BotName,date(""..user.sName.." is back again...")) 

awayArray[user.sName]=nil 

end 

end 

end 

if(strsub(data, 1, 4) == "$To:") then 

-- remove end pipe 

data=strsub(data,1,strlen(data)-1) 

-- is this meant for an away user? 

s,e,whoTo = strfind(data,"$To:%s+(%S+)") 

if (awayArray[whoTo] == nil) then 

--user is not away 

else 

user:SendPM(whoTo,"Away Message: "..awayArray[whoTo]) 

end 

end 

end
My PsyIsrael Network
==================
--=[PsyIsrael DC Hub]=--
--=[PsyIsrael Website]=--
==================

[UK]Madman

#3
This might work .. sorry for any errors as im at work and cant test it!! lol  :P

BotName = "-=<[LsD_-_BoT]>=-" 

awaytable={} 

function Main()
frmHub:RegBot(BotName)
end

function DataArrival(user, data) 
	if strsub(data, 1, 1) == "<"  then 
		data=strsub(data,1,strlen(data)-1) 
		s,e,cmd = strfind(data, "%b<>%s+(%S+)") 
	

			if cmd == "+away" then 
			s,e,cmd,amsg = strfind(data, "%b<>%s+(%S+)%s+(.*)")
			if amsg == nil or amsg == "" then amsg = "I'm away. I might answer later if you're lucky." 	
				
			if awaytable[user.sName] ~= nil then 
			local mess = awaytable[user.sName]
			user:SendData (BotName, "You are already set away, with the message :"..mess); return 1

	else SendToAll(BotName," "..user.sName.." Is now away because: "..amsg) 
	awaytable[user.sName]=amsg 
	return 1;end

	else SendToAll(BotName," "..user.sName.." Is now away because: "..amsg) 
	awaytable[user.sName]=amsg
return 1 
end



			elseif (cmd=="+back") then 

				if awaytable[user.sName] == nil then 
				user:SendData (BotName, "You are not set to away!!")
				return 1
				else 
				SendToAll(BotName," "..user.sName.." is back again...") 
				awaytable[user.sName]=nil 

				end 

			return 1
			end 
end


	if(strsub(data, 1, 4) == "$To:") then 
	data=strsub(data,1,strlen(data)-1) 
	s,e,whoTo = strfind(data,"$To:%s+(%S+)") 

		if awaytable[whoTo] == nil then return 1
		else 
		user:SendPM(whoTo,"Away Message: "..awaytable[whoTo]) 
		end
			

	end 

end

bastya_elvtars

Quotelast token read: `end' at line 112 in string "

or am i stupid?
Everything could have been anything else and it would have just as much meaning.

[UK]Madman

#5
Slight ammendment to the above, think i had an extra end in there!!

Tho line 112 is interesting, since there aint 112 lines . lol

Finishing work now, will check wen home

nuvva slight ammendment, coz it didnt work  :rolleyes:

bastya_elvtars

Everything could have been anything else and it would have just as much meaning.

D-J Valhala

whan user is away if he get PM the Dude Who PM him get the away MSG after each MSG can you change it to be 1 time and like that
DJ-Valhala Is Away : Away MSG
and after it wont show the msg if the user talk to him
My PsyIsrael Network
==================
--=[PsyIsrael DC Hub]=--
--=[PsyIsrael Website]=--
==================

bastya_elvtars

But what are the cmds? :)
Everything could have been anything else and it would have just as much meaning.

[UK]Madman

Current commands:

+away

This sets the user away with their chosen away message, if no message is selected, they will be seat away with the default away message .. e.g.. I'm away. I might answer later if you're lucky.

Anyone sending a PM the the user when set away will recieve the away message.

+back

Removes the away message.

Will try and do other change later, when the boss leaves.....

SMF spam blocked by CleanTalk