How to send messages to OpChat?
 

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

How to send messages to OpChat?

Started by GeceBekcisi, 04 July, 2005, 19:31:59

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

GeceBekcisi

How can I send messages to opchat? This didnt work:
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...

jiten

#1
In that code of yours, you're sending the message to sBot :D
Check this:
SendPmToNick(ToNick, FromNick, Data)	- Data without ending | !
Maybe you should try this:
SendPmToOps(frmHub:GetOpChatName(), "message to send")

Cheers

GeceBekcisi

I was trying to write an report bot but I screwed up. I need help... It doesnt accept more than 1 words as reason..
--// ==================================================
--// 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...

jiten

Change:
local s,e,nick,reason  = string.find(data,"%b<>%s+%S+%s+(%S+)%s+(%S+)")

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

Cheers

Znupi

#4
A bit mor complicated report bottie :D
--[[

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

bastya_elvtars

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

Plus ur "string.finded" bad...check the lua wiki and your problems will be solved  ;D

SMF spam blocked by CleanTalk