Need A welcome bot in pm
 

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

Need A welcome bot in pm

Started by uNiOn, 26 March, 2004, 00:37:57

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

uNiOn

Hey ladies and gents... well i've been tryin to find a bot That works... i whant it to send a welcome message in pm... like the rules ... Got one but it seems to be something wroong with it... couse it just sends the rules in the main chatt would relly like one to that works for users and ops in pm messages thx....


Cheers =P

uNiOn

hey.. got it to work but whant it to be able to use as command to like !rules i use mean machine and when i add the rules in rules.txt  it shows in main window so if someone can help me....

Oh and i use this script......


--Requested by Woodster
--Made by nErBoS

Bot = "Welcome-Bot"

welcome = "text/welcome.txt" --in script folder
rules = "text/rules.txt"
disclaimer = "text/dsc.txt"

function Main()
frmHub:RegBot(Bot)
end

function NewUserConnected(user, data)
   Readtextfile(user, welcome)
   Readtextfile(user, rules)
   Readtextfile(user, disclaimer)
end

function Readtextfile(user, file)
      local filecontents = ""
   local handle = openfile(file, "r")
   if (handle ~= nil) then
      local line = read(handle)
      while line do
           filecontents = filecontents..line.."\r\n"
      line = read(handle)
      end
      closefile(handle)
         user:SendPM(Bot, filecontents)
   end
end

uNiOn

LoL Well got it to dissapear was pretty easy... but still whant it to show rules in pm to op's and master... will tell u al if i get it to work... if its possible to get it to do so....


Cheers =P

nErBoS

Hi,

If i understand you want the bot to send the rules to ops and master in pm when they get connected ???
And what about users ??

Can you be more clear on your request.

Best regards, nErBoS
--## nErBoS Spot ##--

uNiOn

Yes like i said masters and op's and offcourse users to... the thing is i use mean machine and it has the inbuilt command !rules i would relly like so it can be shown in pm to like first when everyone logs on it shows the rules in pm... and when u write !rules/+Rules it shows the rules again in pm =)... if its possible



Cheers =P

nErBoS

Hi,

Is this what you want ???...

--Requested by uNiOn 
--Made by nErBoS 

Bot = "Welcome-Bot" 

rules = "text/rules.txt" --Location of rules txt
sRules = ""

function Main() 
	frmHub:RegBot(Bot) 
end 

function NewUserConnected(user, data) 
	if (sRules == "" and readfrom(rules) ~= nil) then
		Readtextfile(rules, sRules) 
	elseif (sRules ~= "") then
		user:SendPM(Bot, sRules)
	end
end 

OpConnected = NewUserConnected

function Readtextfile(file, string) 
	readfrom(file)
	while 1 do
	local line = read()
		if (line == nil) then
			break
		else
			string = string..line.."\r\n"
		end
	end
	readfrom()
return string
end

Best regards, nErBoS
--## nErBoS Spot ##--

uNiOn

yeah thats almost right but that will do it i think thx agin



Cheers =P

Skrollster

#7
A small bugg caused the textfile to be read every time...

--Requested by uNiOn 
--Made by nErBoS 
--Small fix by Skrollster

Bot = "Welcome-Bot" 

rules = "text/rules.txt" --Location of rules txt
sRules = ""

function Main() 
	frmHub:RegBot(Bot) 
end 

function NewUserConnected(user, data) 
	if (sRules == "" and readfrom(rules) ~= nil) then
		sRules = Readtextfile(rules)
		user:SendPM(Bot, sRules)
	elseif (sRules ~= "") then
		user:SendPM(Bot, sRules)
	end
end 

OpConnected = NewUserConnected

function Readtextfile(file) 
	local string
	readfrom(file)
	while 1 do
	local line = read()
		if (line == nil) then
			break
		else
			string = string..line.."\r\n"
		end
	end
	readfrom()
return string
end

nErBoS

Hi,

Yep Skrollster you are right thanks.

Best regards, nErBoS
--## nErBoS Spot ##--

SMF spam blocked by CleanTalk