You could use a ZO_PreHook to the function CHAT_SYSTEM.OnChatEvent like this e.g.
Lua Code:
function MyOnChatEvent(control, ...)
--Setting enabled?
secondsSinceMidnight = 0
if settings.enableChatBlacklist and settings.chatKeyWords ~= nil and settings.chatKeyWords ~= "" then
if settings.blacklistedTextToChat then
--Get the current time
secondsSinceMidnight = GetSecondsSinceMidnight()
end
--Filter the incoming chat message now
local chatMessageWasBlacklisted = MyFunctionToCheckIfMessageWasBlacklistedWithBooleanReturnCode or false
if chatMessageWasBlacklisted then
--Abort the chat event function so no text is shown in the chat
return true
end
end
--Call the original chat event method now to show the text in the chat
return false
end
ZO_PreHook(CHAT_SYSTEM, "OnChatEvent", MyOnChatEvent)
The secondsSinceMdinight is only there if you want to implement something like a "do not too often" or "wait 2 seconds before next blacklisted message check is done".