Simple Relase-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

Simple Relase-Bot

Started by Mara, 28 March, 2005, 16:24:55

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Mara

Can someone do very simple relase bot where is only write-, read- and deletecommands.  And it have to be LUA 5.
-------------------------------------------

Every thing in this world is so nice that I never can forgot it....


maralandia.no-ip.info   (FIN-HUB)

-------------------------------------------

Ferocious Beast

#1
Very Simple enjoy!!!
-- Verry simple release script nothing fancy
-- Make a file called releases.txt in \Scripts Folder
-- Made By Optimus
-- Converted the script into LUA 5 by 6Marilyn6Manson6
-- Filehandling problem fixed by Madman

sBot = "??Rls-Bot??"

timedate = os.date()
file = "releases.txt"

display1 = "Item"
display2 = "Description"
display3 = "Releases"

function Main()
	frmHub:RegBot(sBot)
end

function ChatArrival(user, data)
	if (string.sub(data, 1, 1) == "<" ) then
		data=string.sub(data,1,string.len(data)-1) 
			_,_,cmd=string.find(data, "%b<>%s+(%S+)")

		if (cmd=="+rls") then
			ReadRelease(user, data, cmd)
			return 1

		elseif (cmd=="+addrls") then
			if user.bOperator or user.iProfile == 2 then
				s,e,cmd,release,desc = string.find( data, "%b<>%s+(%S+)%s+(%S+)%s+(.+)" )

				if desc == nil then
					description = "No "..display2.." specified!"
					s,e,cmd,release = string.find( data, "%b<>%s+(%S+)%s+(%S+)" )
				else
					description = desc
				end
				if release == nil then
					user:SendData(sBot, "*** No "..display1.." specified!")
					return 1
				end

				News("By: "..user.sName.."\t Date: "..timedate.."\r\n"..display1..": "..release.."\r\n"..display2..": "..description.."\r\n")
				SendToAll(sBot, "New "..display3.." Added....By <"..user.sName.."> Type +rls in Main-Chat to show "..display1..".")
				return 1
			else
				user:SendData(sBot, "*** +addrls is only availible to [VIP] and above!")
				return 1
			end
		end
	end
end

function ReadRelease(user, data, cmd)
	local release = ""
--		readfrom(file)
	local file = io.input(file);
	while 1 do
	local line = io.read()
		if (line == nil) then 
		break
	else
		release = release.."	"..line.."\r\n"
		end
	end
		user:SendPM(sBot, "\r\n\r\n".."       "..display3.."s posted by users: ".."\r\n\r\n"..release)
--	readfrom()
	file:read()
end

function News(what)
-- 	appendto(file) 
-- 		write(what.."\n")
-- 	writeto()
	local file = io.open(file, "a+") -- "a+"
	file:write(what.."\n")
	file:close()
end
My New Hub:
PsyBeast.Kicks-Ass.Org
Trance Hub.

jiten

Ferocious Beast, next time try posting the scripts with the [ CODE] [ /CODE] thing (without the space between the "[" and "C"  ;)

Best regards.

Mara

Can somebody add to that script the Delete-command??
-------------------------------------------

Every thing in this world is so nice that I never can forgot it....


maralandia.no-ip.info   (FIN-HUB)

-------------------------------------------

Herodes

QuoteOriginally posted by Mara
Can somebody add to that script the Delete-command??
Get freshstuff for anything more advanced than this.. much much better ..

biggam

Hi i wanted to know how to make the releases come up in Pm rather than Main chat. Does anyone know how to do that or wat to change. thank you

Herodes

Wanna give this one a try ?
-- Verry simple release script nothing fancy
-- Make a file called releases.txt in \Scripts Folder
-- Made By Optimus
-- Converted the script into LUA 5 by 6Marilyn6Manson6
-- Filehandling problem fixed by Madman
--- touched by Herodes

sBot = {
	name = "??Rls-Bot??",
	email = "some.email.com",
	desc = "This is the simplest release bot ever!",
}
timedate =

display1 = "Item"
display2 = "Description"
display3 = "Releases"

function Main()
	frmHub:RegBot(sBot.name, 1, sBot.desc, sBot.email)
	sBot = sBot.name
end

function ChatArrival(user, data)
	data = string.sub(data,1,-2) 
	_,_,cmd=string.find(data, "%b<>%s+(%S+)")
	if (cmd=="+rls") then
		ReadRelease(user, data, cmd)
		return 1
	elseif (cmd=="+addrls") then
		if user.bOperator or user.iProfile == 2 then
			s,e,cmd,release,desc = string.find( data, "%b<>%s+(%S+)%s+(%S+)%s*(.*)" )
			if not release then 
				user:SendData(sBot, "*** No "..display1.." specified!")
				return 1
			end
			News("By: "..user.sName.."\t Date: "..os.date().."\r\n"..display1..": "..release.."\r\n"..display2..": "..(desc or "No "..display2.." specified!").."\r\n")
			SendToAll(sBot, "New "..display3.." Added....By <"..user.sName.."> Type +rls in Main-Chat to show "..display1..".")

		else
			user:SendData(sBot, "*** +addrls is only availible to [VIP] and above!")
		end
		return 1
	end
end

function ReadRelease(user, data, cmd)
	local f = io.input("releases.txt");
	if f then
		local m = ""
		for line in f:lines() m = m..line.."\n" end
		f:close()
		user:SendPM(sBot, "\r\n\r\n\t\t"..display3.."s posted by users: ".."\r\n\r\n"..m)
	end
end

function News(what)
	local f = io.open(file, "a+")
	f:write(what.."\n")
	f:close()
end

SMF spam blocked by CleanTalk