"Box Msg" sender v1.2
 

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

"Box Msg" sender v1.2

Started by Dessamator, 23 May, 2005, 08:56:00

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Dessamator

--By Dessamator
--"Box Msg" aka status bar sender v1.2
--Idea from Chatterbot
--request by dkt

tLines = {n=0}

--Config
bot=frmHub:GetHubBotName() 	--bots name
Filename = "boxmsgs.txt"	-- enter filename
Time = 10 			-- enter time in minutes
TimerOn     =false			-- true to send box msg at intervals
--

function Main()
local file=io.open(Filename,"r")
	if not(file) then
		io.output(Filename)
		io.close()
		io.output()
	end
	if TimerOn then 
		SetTimer(60000*Time)
		StartTimer()	
	end
end

function ChatArrival(user,data)
data= string.sub(data,1,string.len(data)-1)
s,e,cmd,msg = string.find(data,"%b<>%s+(%S+)%s+(.*)")
	if msg then
		if cmd =="!sendmsg" and string.len(msg)<120 then
			SendToAll("\t"..msg..string.rep("\t",11).." is kicking because:")
		return 1
		elseif cmd == "!addboxmsg"  then
			addline(Filename, msg)
			user:SendData(bot,"Done ,added box msg!")
			return 1
		elseif string.len(msg)>120 then
			user:SendData(bot,"Message too long !")              
		return 1
		end
	
	end
end

function OnTimer()
	GetLines(Filename)
	for pos,line in tLines do
		if tonumber(pos) and line and i then
			if tonumber(pos)<=i then
			temp=line
			end
		elseif not(i) or i==table.getn(tLines) then
			i=1
		end

	end
	if temp then
		i=i+1
		SendToAll("\t"..temp..string.rep("\t",11).." is kicking because:")
	end
end


function GetLines(filename)
tLines =nil
tLines = {n=0}
local file = io.open(filename, "r")
	for line in file:lines() do
		table.insert(tLines, line)
	end
		file:close()
end

function addline(filename,msg)
	local file = io.open(filename, "a+")
	file:write("\n"..msg)
	file:close()
end
Ignorance is Bliss.

SMF spam blocked by CleanTalk