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 pHaTTy, 12 October, 2003, 16:03:10

Previous topic - Next topic

0 Members and 4 Guests are viewing this topic.

pHaTTy

Here is my TexterBot from the last forum :o)

-- Jason 0.5 fixed, by Phatty
-- Jason 0.1 wrote on 5th October 2k3
-- You can add ur own files
-- For example make a file named help.txt in the docs folder and then type in main !show help
-- ATM you cant make files with spaces like....Friday the 13th.txt <<< this will not work, but will add soon :)
-- Don't forget to make a folder named docs inside script folder
-- Added no such file error
-- Added who-to now, !show     =  example !show pmme test
-- There is pmme, me, or all
-- Added !lock  
-- Added !version
-- Added self prefix
-- Fixed 1 line read only

Bot = "J???"
Version = "0.5"

mcmd="#"

Blacklist={}

function Main()
frmHub:RegBot(Bot)
end

function WhileRead(user,data)
	while 1 do 
		line = read()
		line = read("*a")
		if line == nil then 
			user:SendData(Bot,"I know of no such file") 
			break end
		if to == "me" then
			user:SendData(Bot,line) 
		elseif to == "all" then
			SendToAll(Bot,line) 
		elseif to == "pmme" then
			user:SendPM(Bot,line) 
		end
	readfrom() 
	return 1
	end
end

function LockOut(user)
if arg == "on" then
	user:SendData(Bot,"You have blacklisted: "..to)
	Blacklist[to]=1
	buser = GetItemByName(to)
	buser:SendPM(Bot,"You have been blacklisted")
	return 1
elseif arg == "off" then
	user:SendData(Bot,"You have removed "..to.." from the blacklist")
	Blacklist[to]=nil
	buser = GetItemByName(to)
	buser:SendPM(Bot,"You have been removed from the blacklist")
	return 1
	end
end


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

	if cmd == mcmd.."show" then
		if Blacklist[user.sName]==nil then
			readfrom("docs/"..arg..".txt")
			WhileRead(user,data)
			return 1
		else
			user:SendData(Bot,"I am denying you access to this command")
			return 1
		end
	elseif cmd == mcmd.."lock" then
		if user.bOperator then
			LockOut(user)
			return 1	
		end
	end
end

	s,e,cmd = strfind(data,"%b<>%s+(%S+)")
	if cmd == mcmd.."version" then
		user:SendData(Bot,"I am Jason "..Version..", by Phatty")
	return 1
	end
end

l8rr,, enjoy

-phatty
Resistance is futile!

pHaTTy

Ooops little mistake

-- Jason 0.5, by Phatty
-- Jason 0.1 wrote on 5th October 2k3
-- You can add ur own files
-- For example make a file named help.txt in the docs folder and then type in main !show help
-- ATM you cant make files with spaces like....Friday the 13th.txt <<< this will not work, but will add soon :)
-- Don't forget to make a folder named docs inside script folder
-- Added no such file error
-- Added who-to now, !show     =  example !show pmme test
-- There is pmme, me, or all
-- Added !lock  
-- Added !version
-- Added self prefix
-- Fixed 1 line read only

Bot = "J???"
Version = "0.5"

mcmd="#"

Blacklist={}

function Main()
frmHub:RegBot(Bot)
end

function WhileRead(user,data)
	while 1 do 
		line = read("*a")
		if line == nil then 
			user:SendData(Bot,"I know of no such file") 
			break end
		if to == "me" then
			user:SendData(Bot,line) 
		elseif to == "all" then
			SendToAll(Bot,line) 
		elseif to == "pmme" then
			user:SendPM(Bot,line) 
		end
	readfrom() 
	return 1
	end
end

function LockOut(user)
if arg == "on" then
	user:SendData(Bot,"You have blacklisted: "..to)
	Blacklist[to]=1
	buser = GetItemByName(to)
	buser:SendPM(Bot,"You have been blacklisted")
	return 1
elseif arg == "off" then
	user:SendData(Bot,"You have removed "..to.." from the blacklist")
	Blacklist[to]=nil
	buser = GetItemByName(to)
	buser:SendPM(Bot,"You have been removed from the blacklist")
	return 1
	end
end


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

	if cmd == mcmd.."show" then
		if Blacklist[user.sName]==nil then
			readfrom("docs/"..arg..".txt")
			WhileRead(user,data)
			return 1
		else
			user:SendData(Bot,"I am denying you access to this command")
			return 1
		end
	elseif cmd == mcmd.."lock" then
		if user.bOperator then
			LockOut(user)
			return 1	
		end
	end
end

	s,e,cmd = strfind(data,"%b<>%s+(%S+)")
	if cmd == mcmd.."version" then
		user:SendData(Bot,"I am Jason "..Version..", by Phatty")
	return 1
	end
end
Resistance is futile!

Jabo

Is there any way to change "!" in !show to something else like * or +......?

pHaTTy

do you mean all the command to +

change the line at top saying mcmd = "#"

to

mcmd = "+" or whatever prefix you want ;)
Resistance is futile!

Jabo

#4
thanks (uk-kingdom)pH?tt?......really appreciate all the help.


pHaTTy

QuoteOriginally posted by Jabo
thanks (uk-kingdom)pH?tt?......really appreciate all the help

np at all
Resistance is futile!

Jabo

Ok.....I now have a problem....I thought by changing the cmd sign from ! to * would fix my prob but it didn't.  Whenever I type *show brady......brady is my .txt file in the docs folder under scripts......nothing happens.  Is there something that I am not doing right.

pHaTTy

Resistance is futile!

[G-T-E]Gate?

Jo pH?tt?

On earlier versions on PtokaX I was able to use EvilBot as my text trigger. But since TD4 came out they dont compliment eachother.
So with ur TexterBot that helps out alot. Nice work.
One thing though, instead of
cmd (Prefix)show divx  <me/all/pmme  >

Can u make it possible to just use
cmd (Prefix)divx  (text comes  to user in PM automatically)
Or
cmd (Prefix)show divx  (text comes  to user in PM automatically)

Thinking of just making it easier for the users when writing .
Would really appreciate it and I too hope that ppl will keep this forum really active..........

plop

try changing the WhileRead for this 1.
function WhileRead(user,data)
	while 1 do 
		line = read("*a")
		if line == nil then 
			user:SendData(Bot,"I know of no such file") 
			break end
		if to == "me" then
			user:SendData(Bot,line) 
		elseif to == "all" then
			SendToAll(Bot,line) 
		elseif to == "pmme" then
			user:SendPM(Bot,line) 
		elseif to == nil then
			user:SendPM(Bot,line) 
		end
	readfrom() 
	return 1
	end
end
not tested so hope it works.

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

pHaTTy

hah yep that will work, im getting slow.............lol
Resistance is futile!

SMF spam blocked by CleanTalk