Author Topic: How to send messages to OpChat?  (Read 3958 times)

0 Members and 1 Guest are viewing this topic.

Offline GeceBekcisi

  • Scripter
  • Lord
  • ******
  • Posts: 311
  • Karma: +10/-1
  • You don't need eyes to see, you need vision..
How to send messages to OpChat?
« on: 04 July, 2005, 19:31:59 »
How can I send messages to opchat? This didnt work:
Code: [Select]
sBot = frmHub:GetHubBotName()
sOpChat = frmHub:GetOpChatName()
SendPmToNick(sBot, sOpChat, "message to send opchat")
Do you need an advanced user handling script? Download UserBekcisi today (Latest Edit)
Features: User + ISP + GeoIP database, user info + share checking and many more...

PtokaX forum

How to send messages to OpChat?
« on: 04 July, 2005, 19:31:59 »

Offline jiten

  • Scripter
  • Forum Legend
  • ******
  • Posts: 1 577
  • Karma: +71/-5
(No subject)
« Reply #1 on: 04 July, 2005, 19:49:35 »
In that code of yours, you're sending the message to sBot :D
Check this:
Code: [Select]
SendPmToNick(ToNick, FromNick, Data) - Data without ending | !Maybe you should try this:
Code: [Select]
SendPmToOps(frmHub:GetOpChatName(), "message to send")
Cheers
« Last Edit: 04 July, 2005, 19:53:17 by jiten »

Offline GeceBekcisi

  • Scripter
  • Lord
  • ******
  • Posts: 311
  • Karma: +10/-1
  • You don't need eyes to see, you need vision..
(No subject)
« Reply #2 on: 04 July, 2005, 20:29:34 »
I was trying to write an report bot but I screwed up. I need help... It doesnt accept more than 1 words as reason..
Code: [Select]
--// ==================================================
--// Simple UserReport  by GeceBekcisi
--// ==================================================

sBot = frmHub:GetHubBotName()
sOpChat = frmHub:GetOpChatName()
function ChatArrival(curUser, data)
local data = string.sub(data,1, -2)
local s,e,cmd = string.find(data, "%b<>%s[%!%+%?%#%+](%S+)")
if (cmd == "report") then
local s,e,nick,reason  = string.find(data,"%b<>%s+%S+%s+(%S+)%s+(%S+)")
if (nick == nil or nick == "") then
curUser:SendData(sBot, "*** Nick is missing. Usage: !report ")
else
if (reason == nil or reason == "") then
curUser:SendData(sBot, "*** Reason is missing. Usage: !report ")
else
curUser:SendData(sBot, "You have successfully reported "..nick.." to operators.")
SendPmToOps(sOpChat, "\r\n\r\n=================================================="..
"\r\n\r\n\tReporter's Name\t\t: "..curUser.sName.."\r\n\t"..
"Reported Person's Name\t: "..nick.."\r\n\tReason for Report"..
"\t\t: "..reason.."\r\n\r\n"..
"==================================================\r\n")
end
end
return 1
end
end
Do you need an advanced user handling script? Download UserBekcisi today (Latest Edit)
Features: User + ISP + GeoIP database, user info + share checking and many more...

Offline jiten

  • Scripter
  • Forum Legend
  • ******
  • Posts: 1 577
  • Karma: +71/-5
(No subject)
« Reply #3 on: 04 July, 2005, 21:13:08 »
Change:
Code: [Select]
local s,e,nick,reason  = string.find(data,"%b<>%s+%S+%s+(%S+)%s+(%S+)")

to:
Code: [Select]
local s,e,nick,reason  = string.find(data,"%b<>%s+%S+%s+(%S+)%s+(.*)")

Cheers

Offline Znupi

  • Junior Member
  • **
  • Posts: 24
  • Karma: +0/-0
  • No one else
    • Znupi's LUA scripts
Re: How to send messages to OpChat?
« Reply #4 on: 10 June, 2006, 14:07:10 »
A bit mor complicated report bottie :D
Code: [Select]
--[[

--== RepOrT BoT bY Znupi ==--

]]--

Bot = frmHub:GetHubBotName()
prefix = "!"

function ChatArrival(user,data)
data = string.sub(data,1,string.len(data)-1)
s,e,cmd=string.find(data,"%s+(%S+)(.*)")
if (cmd == prefix.."report") then
s,e,cmd,nick,reason = string.find(data,"%s+(%S+)%s+(%S+)(.*)")
if (reason == "") then
user:SendData(Bot,"Please add a reason to your report.")
user:SendData(Bot,"Report failed !")
user:SendData(Bot,"Report syntax: !report <user> <reason>")
return 1
end
rep = GetItemByName(nick)
if (rep == nil) then
SendPmToOps(frmHub:GetOpChatName(),user.sName.." reported "..nick.." (user offline) with reason: "..reason)
user:SendData(Bot,"Report succesful !")
return 1
end
if (rep ~= nil ) then
if (rep.bOperator) then
user:SendData(Bot,"Don't even think of reporting an op !")
return 1
else
SendPmToOps(frmHub:GetOpChatName(),user.sName.." reported "..nick.." (user online) with reason: "..reason)
user:SendData(Bot,"Report succesful !")
return 1
end
end

end
end
Tested it and it works just fine ...
Features:
+reports to ops if user is online/offline
+An op cannot be reported
Hope its usefull ...
« Last Edit: 10 June, 2006, 14:08:50 by Znupi »

Offline bastya_elvtars

  • Forum God
  • ****
  • Posts: 3 730
  • Karma: +173/-7
  • The rock n' roll doctor
    • The FreshStuff3 Site
Re: How to send messages to OpChat?
« Reply #5 on: 11 June, 2006, 02:33:02 »
If I were you, I'd do the following:
1) Collect the available profiles.
2) Choose the ones that have OpChat enabled.
3) Send to users of the given profiles on a relevant event.
Everything could have been anything else and it would have just as much meaning.

Markitos

  • Guest
Re: How to send messages to OpChat?
« Reply #6 on: 11 June, 2006, 10:11:07 »
Plus ur "string.finded" bad...check the lua wiki and your problems will be solved  ;D

PtokaX forum

Re: How to send messages to OpChat?
« Reply #6 on: 11 June, 2006, 10:11:07 »