修改优化等
This commit is contained in:
26
Whisper.lua
26
Whisper.lua
@@ -857,6 +857,31 @@ function SFrames.Whisper:Toggle()
|
||||
end
|
||||
end
|
||||
|
||||
-- Filter out addon sync/data messages that abuse the whisper channel.
|
||||
-- These are not real conversations and should not appear in the whisper UI.
|
||||
local ADDON_WHISPER_PATTERNS = {
|
||||
"^%[%u+:%u+%]", -- [ST:HB], [GS:REQ], etc.
|
||||
"^%u+:%u+:%d", -- ADDON:CMD:data
|
||||
"^<.->.+", -- <AddonName>data
|
||||
"^%$%u+%$", -- $ADDON$
|
||||
"^##%u+##", -- ##ADDON##
|
||||
"^{.-}", -- {json-like data}
|
||||
"^LVGS:", -- LevelGearSync
|
||||
"^EEQ:", -- EquipExchange
|
||||
"^GS:%d", -- GearScore sync
|
||||
"^ST:%u", -- SpellTimer
|
||||
}
|
||||
|
||||
local function IsAddonWhisper(text)
|
||||
if not text or text == "" then return false end
|
||||
for _, pat in ipairs(ADDON_WHISPER_PATTERNS) do
|
||||
if string.find(text, pat) then return true end
|
||||
end
|
||||
-- Pure numeric data (e.g. "30343.996") with no real words
|
||||
if string.find(text, "^[%d%.%s%-]+$") then return true end
|
||||
return false
|
||||
end
|
||||
|
||||
-- Hook Events
|
||||
local eventFrame = CreateFrame("Frame")
|
||||
eventFrame:RegisterEvent("CHAT_MSG_WHISPER")
|
||||
@@ -871,6 +896,7 @@ eventFrame:SetScript("OnEvent", function()
|
||||
local text = arg1
|
||||
local sender = arg2
|
||||
if not sender or sender == "" then return end
|
||||
if IsAddonWhisper(text) then return end
|
||||
|
||||
sender = string.gsub(sender, "-.*", "") -- remove realm name if attached
|
||||
|
||||
|
||||
Reference in New Issue
Block a user