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

Mass message bot

Started by kepp, 09 April, 2005, 22:33:11

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

kepp

Stripped from my bot
sBot = "Mass-Message";
sPrefix = "!";

CmdOpt = {
	["massmaster"] = {
		[0] = 1,
		[1] = 1,
		[2] = 0,
		[3] = 0,
		[-1] = 0,
	},
	["massop"] = {
		[0] = 1,
		[1] = 1,
		[2] = 0,
		[3] = 0,
		[-1] = 0,
	},
	["massvip"] = {
		[0] = 1,
		[1] = 1,
		[2] = 1,
		[3] = 0,
		[-1] = 0,
	},
	["massreg"] = {
		[0] = 1,
		[1] = 1,
		[2] = 1,
		[3] = 0,
		[-1] = 0,
	}, 
	["massall"] = {
		[0] = 1,
		[1] = 1,
		[2] = 0,
		[3] = 0,
		[-1] = 0,
	}
};

function Main()
	frmHub:RegBot(sBot);
end

function ChatArrival(user,data)
	data=string.sub(data,1,-2);
	local s,e,cmd = string.find(data,"^%b<>%s+(%S+)");
	local Prefix = string.sub(cmd,1,1);
	if (Prefix == sPrefix) then
		cmd = string.lower(string.sub(cmd,2,string.len(cmd)));
		if (Commands[cmd]) then
			return (Commands[cmd](user,data))
		end
	end
end

Commands = {
	["massmaster"] = 
	function(user,data)
		if (Denial("massmaster",user) == 1) then return 1 end
		local s,e,Msg = string.find(data,"^%b<>%s+%S+%s+(.*)");
		return MassMessage(1,Msg,nil,user);
	end,

	["massop"] = 
	function(user,data)
		if (Denial("massop",user) == 1) then return 1 end
		local s,e,Msg = string.find(data,"^%b<>%s+%S+%s+(.*)");
		return MassMessage(1,Msg,nil,user);
	end,

	["massvip"] = 
	function(user,data)
		if (Denial("massvip",user) == 1) then return 1 end
		local s,e,Msg = string.find(data,"^%b<>%s+%S+%s+(.*)");
		return MassMessage(2,Msg,nil,user);
	end,

	["massreg"] = 
	function(user,data)
		if (Denial("massreg",user) == 1) then return 1 end
		local s,e,Msg = string.find(data,"^%b<>%s+%S+%s+(.*)");
		return MassMessage(3,Msg,nil,user);
	end,

	["massall"] = 
	function(user,data)
		if (Denial("massall",user) == 1) then return 1 end
		local s,e,Msg = string.find(data,"^%b<>%s+%S+%s+(.*)");
		return MassMessage(-1,Msg,1,user);
	end
};

function MassMessage(ProfileIdx, Msg, bToAll, user)
	if (bToAll) then
		SendPmToAll(sBot,Msg);
		user:SendData(sBot,"Your message has been sent!");
		return 1;
	end
	for i,v in frmHub:GetOnlineUsers() do
		if (v.iProfile == ProfileIdx) then
			v:SendPM(sBot,Msg);
		end
	end
	user:SendData(sBot,"Your message has been sent!");
	return 1;
end

function Denial(Table, user)
	if (CmdOpt[Table][user.iProfile] ~= 1) then
		user:SendData(sBot,"You are not allowed to use this command!");
		return 1;
	end
end
Guarding    

chettedeboeuf

Is it possible to have the same script with a graphic message
Exemple :

-------------------------------------------------------------------------
-- Message send by :                                                       --
--                                                                                      --
--                                                                  --
-------------------------------------------------------------------------

With this exemple or better (lol)

Thank you

jiten

#2
Here goes a fast one:
sBot = "Mass-Message";
sPrefix = "!";

CmdOpt = {
	["massmaster"] = {
		[0] = 1,
		[1] = 1,
		[2] = 0,
		[3] = 0,
		[-1] = 0,
	},
	["massop"] = {
		[0] = 1,
		[1] = 1,
		[2] = 0,
		[3] = 0,
		[-1] = 0,
	},
	["massvip"] = {
		[0] = 1,
		[1] = 1,
		[2] = 1,
		[3] = 0,
		[-1] = 0,
	},
	["massreg"] = {
		[0] = 1,
		[1] = 1,
		[2] = 1,
		[3] = 0,
		[-1] = 0,
	}, 
	["massall"] = {
		[0] = 1,
		[1] = 1,
		[2] = 0,
		[3] = 0,
		[-1] = 0,
	}
};

function Main()
	frmHub:RegBot(sBot);
end

function ChatArrival(user,data)
	data=string.sub(data,1,-2);
	local s,e,cmd = string.find(data,"^%b<>%s+(%S+)");
	local Prefix = string.sub(cmd,1,1);
	if (Prefix == sPrefix) then
		cmd = string.lower(string.sub(cmd,2,string.len(cmd)));
		if (Commands[cmd]) then
			return (Commands[cmd](user,data))
		end
	end
end

Commands = {
	["massmaster"] = 
	function(user,data)
		if (Denial("massmaster",user) == 1) then return 1 end
		local s,e,Msg = string.find(data,"^%b<>%s+%S+%s+(.*)");
		return MassMessage(1,Msg,nil,user);
	end,

	["massop"] = 
	function(user,data)
		if (Denial("massop",user) == 1) then return 1 end
		local s,e,Msg = string.find(data,"^%b<>%s+%S+%s+(.*)");
		return MassMessage(1,Msg,nil,user);
	end,

	["massvip"] = 
	function(user,data)
		if (Denial("massvip",user) == 1) then return 1 end
		local s,e,Msg = string.find(data,"^%b<>%s+%S+%s+(.*)");
		return MassMessage(2,Msg,nil,user);
	end,

	["massreg"] = 
	function(user,data)
		if (Denial("massreg",user) == 1) then return 1 end
		local s,e,Msg = string.find(data,"^%b<>%s+%S+%s+(.*)");
		return MassMessage(3,Msg,nil,user);
	end,

	["massall"] = 
	function(user,data)
		if (Denial("massall",user) == 1) then return 1 end
		local s,e,Msg = string.find(data,"^%b<>%s+%S+%s+(.*)");
		return MassMessage(-1,Msg,1,user);
	end
};

function MassMessage(ProfileIdx, Msg, bToAll, user)
	local MassSend = function(user,Msg,Profile)
		local msg = "\r\n\r\n\t"..string.rep("-",100).."\r\n"
		msg = msg.."\t-- Sender: "..user.sName.."\r\n\r\n"
		msg = msg.."\t-- To: "..Profile.."\r\n"
		msg = msg.."\t-- Message: "..Msg.."\r\n"
		msg = msg.."\t"..string.rep("-",100)
		return msg
	end
	if (bToAll) then
		SendPmToAll(sBot,MassSend(user,Msg,"All"));
		user:SendData(sBot,"Your message has been sent!");
		return 1;
	end
	for i,v in frmHub:GetOnlineUsers() do
		if (v.iProfile == ProfileIdx) then
			v:SendPM(sBot,MassSend(user,Msg,GetProfileName(ProfileIdx)));
			SendPmToOps(sBot,"Report of Mass Message:"..MassSend(user,Msg,GetProfileName(ProfileIdx)))
		end
	end
	user:SendData(sBot,"Your message has been sent!");
	return 1;
end

function Denial(Table, user)
	if (CmdOpt[Table][user.iProfile] ~= 1) then
		user:SendData(sBot,"You are not allowed to use this command!");
		return 1;
	end
end

chettedeboeuf

#3
Thank you for your help.

function MassMessage(ProfileIdx, Msg, bToAll, user)

   if (bToAll) then

      SendPmToAll(sBot,Msg);

      user:SendData(sBot,"Your message has been sent!");

      return 1;

   end

   for i,v in frmHub:GetOnlineUsers() do

      if (v.iProfile == ProfileIdx) then

         v:SendPM(sBot,Msg);

      end

   end

   user:SendData(sBot,"Your message has been sent!");

   return 1;

end


Is it possible to have a copy of the send message ???

Thank you again

jiten

QuoteOriginally posted by chettedeboeuf
Is it possible to have a copy of the send message ???
What do you mean with that? I didn't get it.

Best regards

chettedeboeuf

Yes I would have a copy of the send message when you send this message :

user:SendData(sBot,"Your message has been sent!");

We have few board for PtokaX in french and I have some problems with english
Thank you

bastya_elvtars

I have a question that is not too ontopic, but if I would like to send mass message the way Verli does, I have to use a raw like this, don't I?

for _,obj in frmHub:GetOnlineUsers() do
   obj:SendData([color=#CC33CC]"$To: "..obj.sName.." From: "..botname.."$ hi all!"[/color])
end
Everything could have been anything else and it would have just as much meaning.

jiten

QuoteOriginally posted by chettedeboeuf
Yes I would have a copy of the send message when you send this message :

user:SendData(sBot,"Your message has been sent!");

We have few board for PtokaX in french and I have some problems with english
Thank you
I still don't understand what you mean... That report message is always sent to the user who uses the mass command.
You can explain it in french if you want.

Cheers

chettedeboeuf

Merci

Je voudrais avoir une copie du message envoy? quand le script envoie 'Your message has been sent!'

Exemple :

Report of mass-message
Sender :          
To :
Message :

Et seulement aux OPs et Admins

Merci

Dessamator

to bastya :hmm i guess it could work :)

and chettedeboeuf, thats simple to do, if somebody doesnt do it tomorrow ill do it,:)
Ignorance is Bliss.

bastya_elvtars

QuoteOriginally posted by Dessamator
to bastya :hmm i guess it could work :)

OK, thx, sorry for having these questions but my knowledge definitely needs a /refresh.  :D
Everything could have been anything else and it would have just as much meaning.

jiten

QuoteOriginally posted by chettedeboeuf
Merci

Je voudrais avoir une copie du message envoy? quand le script envoie 'Your message has been sent!'

Exemple :

Report of mass-message
Sender :          
To :
Message :

Et seulement aux OPs et Admins

Merci
First post updated with your request.

Best regards

chettedeboeuf

Thank you jiten

Oupsss : I've a question, what means 'jiten' ??

jiten

QuoteOriginally posted by chettedeboeuf
Thank you jiten

Oupsss : I've a question, what means 'jiten' ??
You're welcome :]
What does "jiten" means?
Well, I don't have an exact answer for that, but, if I'm not wrong a part of it means "victory". Don't know of the whole word :D

Cheers

FoRM

hi  :)

i need this script with message to unregs. thx

Dessamator

try this :
sBot = "Mass-Message";
sPrefix = "!";

CmdOpt = {
	["massmaster"] = {
		[0] = 1,
		[1] = 1,
		[2] = 0,
		[3] = 0,
		[-1] = 0,
	},
	["massop"] = {
		[0] = 1,
		[1] = 1,
		[2] = 0,
		[3] = 0,
		[-1] = 0,
	},
	["massvip"] = {
		[0] = 1,
		[1] = 1,
		[2] = 1,
		[3] = 0,
		[-1] = 0,
	},
	["massreg"] = {
		[0] = 1,
		[1] = 1,
		[2] = 1,
		[3] = 0,
		[-1] = 0,
	}, 
	["massall"] = {
		[0] = 1,
		[1] = 1,
		[2] = 0,
		[3] = 0,
		[-1] = 0,
	},
	["massunreg"] = {
		[0] = 1,
		[1] = 1,
		[2] = 0,
		[3] = 0,
		[-1] = 0,
	}
};

function Main()
	frmHub:RegBot(sBot);
end

function ChatArrival(user,data)
	data=string.sub(data,1,-2);
	local s,e,cmd = string.find(data,"^%b<>%s+(%S+)");
	local Prefix = string.sub(cmd,1,1);
	if (Prefix == sPrefix) then
		cmd = string.lower(string.sub(cmd,2,string.len(cmd)));
		if (Commands[cmd]) then
			return (Commands[cmd](user,data))
		end
	end
end

Commands = {
	["massmaster"] = 
	function(user,data)
		if (Denial("massmaster",user) == 1) then return 1 end
		local s,e,Msg = string.find(data,"^%b<>%s+%S+%s+(.*)");
		return MassMessage(1,Msg,nil,user);
	end,

	["massop"] = 
	function(user,data)
		if (Denial("massop",user) == 1) then return 1 end
		local s,e,Msg = string.find(data,"^%b<>%s+%S+%s+(.*)");
		return MassMessage(1,Msg,nil,user);
	end,

	["massvip"] = 
	function(user,data)
		if (Denial("massvip",user) == 1) then return 1 end
		local s,e,Msg = string.find(data,"^%b<>%s+%S+%s+(.*)");
		return MassMessage(2,Msg,nil,user);
	end,

	["massreg"] = 
	function(user,data)
		if (Denial("massreg",user) == 1) then return 1 end
		local s,e,Msg = string.find(data,"^%b<>%s+%S+%s+(.*)");
		return MassMessage(3,Msg,nil,user);
	end,

	["massall"] = 
	function(user,data)
		if (Denial("massall",user) == 1) then return 1 end
		local s,e,Msg = string.find(data,"^%b<>%s+%S+%s+(.*)");
		return MassMessage(-1,Msg,1,user);
	end,
	["massunreg"] = 
	function(user,data)
		if (Denial("massunreg",user) == 1) then return 1 end
		local s,e,Msg = string.find(data,"^%b<>%s+%S+%s+(.*)");
		return MassMessage(-1,Msg,nil,user);
	end,
};

function MassMessage(ProfileIdx, Msg, bToAll, user)
	local MassSend = function(user,Msg,Profile)
		local msg = "\r\n\r\n\t"..string.rep("-",100).."\r\n"
		msg = msg.."\t-- Sender: "..user.sName.."\r\n\r\n"
		local Profile = Profile or "Unreg"
		msg = msg.."\t-- To: "..Profile.."\r\n"
		msg = msg.."\t-- Message: "..Msg.."\r\n"
		msg = msg.."\t"..string.rep("-",100)
		return msg
	end
	if (bToAll) then
		SendPmToAll(sBot,MassSend(user,Msg,"All"));
		user:SendData(sBot,"Your message has been sent!");
		return 1;
	end
	for i,v in frmHub:GetOnlineUsers() do
		if (v.iProfile == ProfileIdx) then
			v:SendPM(sBot,MassSend(user,Msg,GetProfileName(ProfileIdx)));
			SendPmToOps(sBot,"Report of Mass Message:"..MassSend(user,Msg,GetProfileName(ProfileIdx)))
		end
	end
	user:SendData(sBot,"Your message has been sent!");
	return 1;
end

function Denial(Table, user)
	if (CmdOpt[Table][user.iProfile] ~= 1) then
		user:SendData(sBot,"You are not allowed to use this command!");
		return 1;
	end
end
Ignorance is Bliss.

SMF spam blocked by CleanTalk