PtokaX forum

Archive => Archived 5.0 boards => Finished Scripts => Topic started by: kepp on 09 April, 2005, 22:33:11

Title: Mass message bot
Post by: kepp on 09 April, 2005, 22:33:11
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
Title:
Post by: chettedeboeuf on 31 May, 2005, 17:18:38
Is it possible to have the same script with a graphic message
Exemple :

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

With this exemple or better (lol)

Thank you
Title:
Post by: jiten on 31 May, 2005, 18:35:24
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
Title:
Post by: chettedeboeuf on 31 May, 2005, 18:39:11
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
Title:
Post by: jiten on 31 May, 2005, 21:07:00
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
Title:
Post by: chettedeboeuf on 31 May, 2005, 21:25:59
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
Title:
Post by: bastya_elvtars on 31 May, 2005, 22:36:46
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
Title:
Post by: jiten on 31 May, 2005, 22:41:00
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
Title:
Post by: chettedeboeuf on 31 May, 2005, 22:53:00
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
Title:
Post by: Dessamator on 01 June, 2005, 00:17:11
to bastya :hmm i guess it could work :)

and chettedeboeuf, thats simple to do, if somebody doesnt do it tomorrow ill do it,:)
Title:
Post by: bastya_elvtars on 01 June, 2005, 02:08:02
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
Title:
Post by: jiten on 01 June, 2005, 09:33:06
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
Title:
Post by: chettedeboeuf on 01 June, 2005, 11:31:06
Thank you jiten

Oupsss : I've a question, what means 'jiten' ??
Title:
Post by: jiten on 01 June, 2005, 15:59:59
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
Title:
Post by: FoRM on 10 August, 2005, 14:44:06
hi  :)

i need this script with message to unregs. thx
Title:
Post by: Dessamator on 10 August, 2005, 15:24:30
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