View Single Post
03-14-23, 02:28 AM   #1
nancey
A Kobold Labourer
Join Date: Mar 2023
Posts: 1
Intercept outgoing chatmessages

Hi

Due to a 10 day ban I just got for saying "idiot" I've decided to create a simple addon to filter out the word "idiot".. yes I could just not say it, but solo shuffles.. man..


So far I've figured out (I think) that i want to intercept the event CHAT_MESSAGE_SAY
this is where google stops helping me, so any suggestions on how i either change the "msg" of the event or cancels the event and fires a new one with the edited text?

Code:
print("Outgoing Mature Language Filter Loaded")

local f=CreateFrame("Frame");-- Need a frame to capture events
f:RegisterEvent("CHAT_MSG_SAY");-- Register our event
f:SetScript("OnEvent",function(self,event,msg)-- OnEvent handler receives event triggers
	if event=="CHAT_MSG_SAY" and msg:match("idiot") then-- Someone sends "hello World" in /say
		
		-- somehow set msg to something else, prevent default event and fire new sendmessage

	end
end);
  Reply With Quote