Add ChatSniffer module and update saved variables
This commit is contained in:
38
Modules/ChatSniffer.lua
Normal file
38
Modules/ChatSniffer.lua
Normal file
@@ -0,0 +1,38 @@
|
||||
local _, shared = ...
|
||||
---@cast shared HeimdallShared
|
||||
local ModuleName = "ChatSniffer"
|
||||
|
||||
---@diagnostic disable-next-line: missing-fields
|
||||
shared.ChatSniffer = {}
|
||||
function shared.ChatSniffer.Init()
|
||||
Heimdall_Chat = Heimdall_Chat or {}
|
||||
local frame = CreateFrame("Frame")
|
||||
frame:RegisterEvent("CHAT_MSG_SAY")
|
||||
frame:RegisterEvent("CHAT_MSG_YELL")
|
||||
frame:RegisterEvent("CHAT_MSG_CHANNEL")
|
||||
frame:RegisterEvent("CHAT_MSG_WHISPER")
|
||||
frame:RegisterEvent("CHAT_MSG_CHANNEL_JOIN")
|
||||
frame:RegisterEvent("CHAT_MSG_CHANNEL_LEAVE")
|
||||
frame:RegisterEvent("CHAT_MSG_EMOTE")
|
||||
frame:RegisterEvent("CHAT_MSG_PARTY")
|
||||
frame:RegisterEvent("CHAT_MSG_PARTY_LEADER")
|
||||
frame:RegisterEvent("CHAT_MSG_RAID")
|
||||
frame:RegisterEvent("CHAT_MSG_RAID_LEADER")
|
||||
frame:RegisterEvent("CHAT_MSG_RAID_WARNING")
|
||||
frame:RegisterEvent("CHAT_MSG_SYSTEM")
|
||||
frame:RegisterEvent("CHAT_MSG_TEXT_EMOTE")
|
||||
frame:RegisterEvent("CHAT_MSG_YELL")
|
||||
frame:SetScript("OnEvent", function(self, event, msg, sender, language, channel)
|
||||
local log = string.format(
|
||||
"%s|%s|%s|%s|%s",
|
||||
tostring(event),
|
||||
tostring(sender),
|
||||
tostring(msg),
|
||||
tostring(language),
|
||||
tostring(channel)
|
||||
)
|
||||
Heimdall_Chat[#Heimdall_Chat + 1] = log
|
||||
end)
|
||||
|
||||
print("[Heimdall] ChatSniffer loaded")
|
||||
end
|
||||
Reference in New Issue
Block a user