Files

30 lines
1.5 KiB
Lua
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
-- OctoTextSize: addon-local factory; Blizzard CreateFrame is unchanged.
local CreateFrame = OctoTextSize and OctoTextSize.WrapFactory(CreateFrame) or CreateFrame
-- This is intentionally an exact system-message filter. If an original UI
-- variant prints the reminder directly, leave it visible rather than replace
-- every chat frame's AddMessage or remove arbitrary chat lines.
local reminder = "Remember to act responsibly, protect your personal information, and don't post anything offensive. View our In-Game Code of Conduct on https://support.blizzard.com/article/42673 for more information."
local reminderFilterInstalled = false
local function ReminderFilter(_, event, message)
if event ~= "CHAT_MSG_SYSTEM" or type(message) ~= "string" then return false end
local plain = message:gsub("|H[^|]*|h(.-)|h", "%1")
:gsub("|c%x%x%x%x%x%x%x%x", ""):gsub("|r", "")
:gsub("’", "'"):gsub("%s+", " "):match("^%s*(.-)%s*$")
return plain == reminder
end
local function InstallReminderFilter()
if not reminderFilterInstalled and type(ChatFrame_AddMessageEventFilter) == "function" then
ChatFrame_AddMessageEventFilter("CHAT_MSG_SYSTEM", ReminderFilter)
reminderFilterInstalled = true
end
end
local events = CreateFrame("Frame")
events:RegisterEvent("ADDON_LOADED")
events:RegisterEvent("PLAYER_LOGIN")
events:RegisterEvent("PLAYER_ENTERING_WORLD")
events:SetScript("OnEvent", function()
InstallReminderFilter()
end)
InstallReminderFilter()