TexterBot
 

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

TexterBot

Started by [G-T-E]Gate?, 05 January, 2004, 19:04:34

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

[G-T-E]Gate?

Looking for a Texter bot ,
 Explaination;
PtokaX DC Hub 0.3.2.6 TestDrive 4\scripts\Textfiles

In scripts folder is texterbot.lua  that locates text files in files folder.

User types - divx  in main chat and gets in Pm to User the requested info in that file.

Anyone ?

NightLitch

#1
* UPDATED *

try it now

--ShowInfo v1.0 by latinmusic == poweroperator 18/04/2003
--Based on TrickerBot 2 by ?Ptaczek?
--Based on a few lines of DirtyBot made by Dirty Finger
--This script read several files from a table and display them to a single user when he type the appropiate command...
--The directory --> Files <-- must exist inside of PtokaX Script Directory...
--The files --> rules.txt, net.txt, logo.txt and news.txt <-- must exist inside Files Directory...
--Enjoy
BotName = "?-=Admin=-?"
Files = {
		["?codec"] = "Files/codec.txt",
		["?news"] = "Files/news.txt",
		["?faq"] = "Files/faq.txt",
--		["?rules"] = "Files/rules.txt", --If you're using DirtyBot, don't uncomment this line
	}
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,msg = strfind( data, "%b<>%s+(%S+)" )

		for key, value in Files do
			if( strfind( strlower(msg), key) ) then
				s,e,msg,where = strfind(data, "<"..user.sName..">%s+(%S+)%s+(.+)")
				-- where must be main or pm
				txtToShow, x = gsub(value, "%b[]", user.sName) 
			--	SendToAll( data ) -- Now the command will not sent to all
				Show(user, TheFile, pm)
				return 1
			end
		end
	end
end


function Show(user, TheFile, where)
	readfrom(txtToShow, "r")
	local message = ""
	while 1 do
		local line = read()
		if line == nil then break
		else
			message = message..line.."\r\n"
		end
	end
	if strlower(where) == "main" then
		user:SendData(BotName, message)
	elseif strlower(where) == "pm" then
		user:SendPM(BotName, message)
	end
	readfrom()
end

Hope it does what you want...
//NL

[G-T-E]Gate?

Tks ,
 Working ok But Appreciate PM to User instead of result in main chat ..
gate :D

plop

here you are, this should do all and more.
-- texter bot by plop
-- shows text files from a folder named text.
-- doesn't mather what prefix is used.
-- if the file excist it shows.

Bot = "something"

function Main()
   frmHub:RegBot(Bot)
end

function DataArrival(user, data)
   data=strsub(data,1,strlen(data)-1) 
   if( strsub(data, 1, 1) == "<" ) then
      s,e,cmd = strfind(data,"%b<>%s+(%S+)") 
      cmd = strsub(cmd, 2,strlen(cmd))
      if readfrom("text/"..cmd..".txt") then
         showtext(user, cmd)
         return 1
      end
   elseif(strsub(data, 1, 4) == "$To:") then
      s,e,cmd = strfind(data,"$To:%s+%S+%s+From:%s+%S+%s+$%b<>%s+(%S+)")
      cmd = strsub(cmd, 2,strlen(cmd))
      if readfrom("text/"..cmd..".txt") then
         showtext(user, cmd)
         return 1
      end
   end
end


function showtext(user, cmd)
   lines = "\r\n\r\n"
   readfrom("text/"..cmd..".txt")
   while 1 do
      local line = read()
      if line == nil then 
         readfrom()
         break 
      end
      lines = lines..line.."\r\n"
   end
   user:SendPM(Bot, lines.." |")
end
plop
http://www.plop.nl lua scripts/howto\'s.
http://www.thegoldenangel.net
http://www.vikingshub.com
http://www.lua.org

>>----> he who fights hatred with hatred, drives the spreading of hatred <----<<

NightLitch

Nice one plop... Was thinking in that direction but
became lazy... :-)
//NL

plop

QuoteOriginally posted by NightLitch
Nice one plop... Was thinking in that direction but
became lazy... :-)
well took some minutes 2 make but the result is even lazyer. lol

plop
http://www.plop.nl lua scripts/howto\'s.
http://www.thegoldenangel.net
http://www.vikingshub.com
http://www.lua.org

>>----> he who fights hatred with hatred, drives the spreading of hatred <----<<

[G-T-E]Gate?

Tks Plop
Just what I needed
 :D

suyang99

how can i read the random line

c h i l l a

a faster way is this func.


function ReadHelp(file)
	local handle = openfile(FDFolder.."/"..file, "r")
	local contents = gsub(read(handle, "*a"),strchar(10), "\r\n")
	closefile (handle)
	return contents
end

plop

QuoteOriginally posted by c h i l l a
a faster way is this func.


function ReadHelp(file)
	local handle = openfile(FDFolder.."/"..file, "r")
	local contents = gsub(read(handle, "*a"),strchar(10), "\r\n")
	closefile (handle)
	return contents
end
thx, sure is a lot easyer/shorter that way.
-- texter bot by plop
-- thx 2 chilla for the faster routine for opening the files
-- shows text files from a folder named text.
-- doesn't mather what prefix it used.
-- if the file excist it shows.

Bot = "something"
FDFolder = "text"

function Main()
   frmHub:RegBot(Bot)
end

function DataArrival(user, data)
   data=strsub(data,1,strlen(data)-1) 
   if( strsub(data, 1, 1) == "<" ) then
      s,e,cmd = strfind(data,"%b<>%s+(%S+)") 
      cmd = strsub(cmd, 2,strlen(cmd))
      if readfrom(FDFolder.."/"..cmd..".txt") then
         showtext(user, cmd)
         return 1
      end
   elseif(strsub(data, 1, 4) == "$To:") then
      s,e,cmd = strfind(data,"$To:%s+%S+%s+From:%s+%S+%s+$%b<>%s+(%S+)")
      cmd = strsub(cmd, 2,strlen(cmd))
      if readfrom(FDFolder.."/"..cmd..".txt") then
         showtext(user, cmd)
         return 1
      end
   end
end

function showtext(user, file)
	local handle = openfile(FDFolder.."/"..file..".txt", "r")
	local contents = gsub(read(handle, "*a"),strchar(10), "\r\n")
	closefile (handle)
	user:SendPM(Bot, "\r\n"..contents.."\r\n|")
end
plop
http://www.plop.nl lua scripts/howto\'s.
http://www.thegoldenangel.net
http://www.vikingshub.com
http://www.lua.org

>>----> he who fights hatred with hatred, drives the spreading of hatred <----<<

WickeD

#10
This script do I want to get to work! I do not work!

Can eny one help mee to get this script to work?


--ShowInfo v1.0 by latinmusic == poweroperator 18/04/2003
--Based on TrickerBot 2 by ?Ptaczek?
--Based on a few lines of DirtyBot made by Dirty Finger
--This script read several files from a table and display them to a single user when he type the appropiate command...
--The directory --> Files <-- must exist inside of PtokaX Script Directory...
--The files --> rules.txt, net.txt, logo.txt and news.txt <-- must exist inside Files Directory...
--Enjoy
BotName = "Info-Box"
Files = {
		["?codec"] = "Files/codec.txt",
		["?news"] = "Files/news.txt",
		["?faq"] = "Files/faq.txt",
--		["?rules"] = "Files/rules.txt", --If you're using DirtyBot, don't uncomment this line
	}
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,msg = strfind( data, "%b<>%s+(%S+)" )

		for key, value in Files do
			if( strfind( strlower(msg), key) ) then
				s,e,msg,where = strfind(data, "<"..user.sName..">%s+(%S+)%s+(.+)")
				-- where must be main or pm
				txtToShow, x = gsub(value, "%b[]", user.sName) 
			--	SendToAll( data ) -- Now the command will not sent to all
				Show(user, TheFile, pm)
				return 1
			end
		end
	end
end


function Show(user, TheFile, where)
	readfrom(txtToShow, "r")
	local message = ""
	while 1 do
		local line = read()
		if line == nil then break
		else
			message = message..line.."\r\n"
		end
	end
	if strlower(where) == "main" then
		user:SendData(BotName, message)
	elseif strlower(where) == "pm" then
		user:SendPM(BotName, message)
	end
	readfrom()
end

I get this error massage:

Syntax error: bad argument #1 to `strlower' (string expected, got nil)
stack traceback:
   1:  function `strlower' [C]
   2:  function `Show' at line 47 [file `...m\ptokaX 0.330 build 15.25\scripts\Info-Box.lua']
   3:  function `DataArrival' at line 29 [file `...m\ptokaX 0.330 build 15.25\scripts\Info-Box.lua']



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

//WickeD

BottledHate

QuoteOriginally posted by WickeD
This script do I want to get to work! I do not work!

Can eny one help mee to get this script to work?

---snip-----


I get this error massage:

Syntax error: bad argument #1 to `strlower' (string expected, got nil)
stack traceback:
   1:  function `strlower' [C]
   2:  function `Show' at line 47 [file `...m\ptokaX 0.330 build 15.25\scripts\Info-Box.lua']
   3:  function `DataArrival' at line 29 [file `...m\ptokaX 0.330 build 15.25\scripts\Info-Box.lua']



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

//WickeD

that is because u didn't use the full command....

for example:

?codec pm
?codec main


it looks like "pm" or "main" is required in this script. (kinda lame)

replace the show function in yours with this one and it will default to main unless pm is specified:

function Show(user, TheFile, where)
	readfrom(txtToShow, "r")
	local message = ""
	while 1 do
		local line = read()
		if line == nil then break
		else
			message = message..line.."\r\n"
		end
	end
	where = where or "main"
	if strlower(where) == "main" then
		user:SendData(BotName, message)
	elseif strlower(where) == "pm" then
		user:SendPM(BotName, message)
	end
	readfrom()
end

hope this helps...

-BH
Homepage: www.bottledhate.webhop.org

Compiling  Lua scripts is LAME!!!!!

WickeD

I get this error:

Syntax error: `=' expected;
  last token read: `he' at line 5 in file `C:\Program\ptokaX 0.330 build 15.25\scripts\Info-Box.lua'

In this Script:

--ShowInfo v1.0 by latinmusic == poweroperator 18/04/2003
--Based on TrickerBot 2 by ?Ptaczek?
--Based on a few lines of DirtyBot made by Dirty Finger
--This script read several files from a table and display them to a single user
when he type the appropiate command...
--The directory --> Files <-- must exist inside of PtokaX Script Directory...
--The files --> rules.txt, net.txt, logo.txt and news.txt <-- must exist inside
Files Directory...
--Enjoy
BotName = "[Bot]Info-Box"
Files = {
		["?infolista"] = "Files/infolista.txt",
		["?v?der"] = "Files/v?der.txt",
		["?rippadvd"] = "Files/rippadvd.txt",
		["?subtitles"] = "Files/subtitles.txt",
		["?codec"] = "Files/codec.txt",
		["?vlc"] = "Files/vlc.txt",
		["?dataume?"] = "Files/dataume?.txt",
		["?dataweb"] = "Files/dataweb.txt",
		["?teleadress"] = "Files/teleadress.txt",
		["?tidningar"] = "Files/tidningar.txt",
		["?priser"] = "Files/priser.txt",
		["?isp"] = "Files/isp.txt",
		["?annonser"] = "Files/annonser.txt",
		["?s?kmotor"] = "Files/s?kmotor.txt",
		["?crackar"] = "Files/crackar.txt",
		["?nysl?ppt"] = "Files/nysl?ppt.txt",
		["?fakefiler"] = "Files/fakefiler.txt",
		["?mcaff?r"] = "Files/mcaff?r.txt",
		["?mcclub"] = "Files/mcclub.txt",
		["?bilaff?r"] = "Files/bilaff?r.txt",
		["?k?rkort"] = "Files/k?rkort.txt",
		["?tvprog"] = "Files/tvprog.txt",
		["?svar"] = "Files/svar.txt",
		["?promille"] = "Files/promille.txt",
		["?hashing"] = "Files/hashing.txt",
		["?mplayer"] = "Files/mplayer.txt",
		["?sfv"] = "Files/sfv.txt",
		["?vitmakt"] = "Files/vitmakt.txt",
		["?regler"] = "Files/regler.txt",
		["?l?mnahub"] = "Files/l?mnahub.txt",
		["?staff"] = "Files/staff.txt",
		["?uppgift"] = "Files/uppgift.txt",
		["?share"] = "Files/share.txt",
		["?slots"] = "Files/slots.txt",
		["?hub"] = "Files/hub.txt",
		["?bot"] = "Files/bot.txt",
		["?dmz"] = "Files/dmz.txt",
		["?clienter"] = "Files/clienter.txt",
		["?router"] = "Files/router.txt",
		["?firewall"] = "Files/firewall.txt",
		["?dc++color"] = "Files/dc++color.txt",
		["?faq"] = "Files/faq.txt",
		["?forum"] = "Files/forum.txt",
		["?e-post"] = "Files/e-post.txt",
		["?kickad"] = "Files/kickad.txt",
		["?bannad"] = "Files/bannad.txt",
	}
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,msg = strfind( data, "%b<>%s+(%S+)" )

		for key, value in Files do
			if( strfind( strlower(msg), key) ) then
				s,e,msg,where = strfind(data, "<"..user.sName..">%s+(%S+)%s+(.+)")
				-- where must be main or pm
				txtToShow, x = gsub(value, "%b[]", user.sName) 
			--	SendToAll( data ) -- Now the command will not sent to all
				Show(user, TheFile, pm)
				return 1
			end
		end
	end
end


function Show(user, TheFile, where)
	readfrom(txtToShow, "r")
	local message = ""
	while 1 do
		local line = read()
		if line == nil then break
		else
			message = message..line.."\r\n"
		end
	end
	where = where or "main"
	if strlower(where) == "main" then
		user:SendData(BotName, message)
	elseif strlower(where) == "pm" then
		user:SendPM(BotName, message)
	end
	readfrom()
end

Why??

BottledHate

#13
lol...

--ShowInfo v1.0 by latinmusic == poweroperator 18/04/2003
--Based on TrickerBot 2 by ?Ptaczek?
--Based on a few lines of DirtyBot made by Dirty Finger
--This script read several files from a table and display them to a single user
when he type the appropiate command...
--The directory --> Files <-- must exist inside of PtokaX Script Directory...
--The files --> rules.txt, net.txt, logo.txt and news.txt <-- must exist inside
Files Directory...

should be...

--ShowInfo v1.0 by latinmusic == poweroperator 18/04/2003
--Based on TrickerBot 2 by ?Ptaczek?
--Based on a few lines of DirtyBot made by Dirty Finger
--This script read several files from a table and display them to a single user when he type the appropiate command...
--The directory --> Files <-- must exist inside of PtokaX Script Directory...
--The files --> rules.txt, net.txt, logo.txt and news.txt <-- must exist inside Files Directory...


somehow u wraped the words..
:D

-BH
Homepage: www.bottledhate.webhop.org

Compiling  Lua scripts is LAME!!!!!

WickeD

It works now! But!!! It shows in Main-Chat! And I want it to bee shown i a PM to the user that write the command!

Can you help mee whit that to my m8??

//WickeD

BottledHate

#15
change:
where = where or "main"

to:
where = where or "pm"

then u can still make it go to main... but defaults to pm

:D

-BH
Homepage: www.bottledhate.webhop.org

Compiling  Lua scripts is LAME!!!!!

WickeD

Now it works  fine my m8!

Thx a lot my m8!!!!

=)


//WickeD

BottledHate

QuoteOriginally posted by WickeD
Now it works  fine my m8!

Thx a lot my m8!!!!

=)


//WickeD

no problem.. happy i could help.  :)

-BH
Homepage: www.bottledhate.webhop.org

Compiling  Lua scripts is LAME!!!!!

SMF spam blocked by CleanTalk