修改优化等

This commit is contained in:
rucky
2026-03-18 02:01:36 +08:00
parent 2a55dd6dad
commit 923a1f9ce2
15 changed files with 1578 additions and 371 deletions

View File

@@ -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