Add chatSniffer configuration and integrate into Heimdall initialization
This commit is contained in:
@@ -84,6 +84,7 @@ local function init()
|
||||
---@field configurator HeimdallConfiguratorConfig
|
||||
---@field stinkyCache HeimdallStinkyCacheConfig
|
||||
---@field achievementSniffer HeimdallAchievementSnifferConfig
|
||||
---@field chatSniffer HeimdallChatSnifferConfig
|
||||
---@field whisperNotify table<string, string>
|
||||
---@field addonPrefix string
|
||||
---@field stinkies table<string, boolean>
|
||||
@@ -116,6 +117,10 @@ local function init()
|
||||
--/run Heimdall_Data.config.who.queries="g-\"БеспредеЛ\"|ally"
|
||||
Heimdall_Data.config = {
|
||||
debug = shared.GetOrDefault(Heimdall_Data, { "config", "debug" }, false),
|
||||
chatSniffer = {
|
||||
enabled = shared.GetOrDefault(Heimdall_Data, { "config", "chatSniffer", "enabled" }, false),
|
||||
debug = shared.GetOrDefault(Heimdall_Data, { "config", "chatSniffer", "debug" }, false),
|
||||
},
|
||||
spotter = {
|
||||
enabled = shared.GetOrDefault(Heimdall_Data, { "config", "spotter", "enabled" }, true),
|
||||
debug = shared.GetOrDefault(Heimdall_Data, { "config", "spotter", "debug" }, false),
|
||||
|
||||
@@ -6,6 +6,7 @@ local ModuleName = "ChatSniffer"
|
||||
---@field enabled boolean
|
||||
---@field debug boolean
|
||||
|
||||
---@class ChatSniffer
|
||||
shared.ChatSniffer = {
|
||||
Init = function()
|
||||
Heimdall_Chat = Heimdall_Chat or {}
|
||||
@@ -26,6 +27,10 @@ shared.ChatSniffer = {
|
||||
frame:RegisterEvent("CHAT_MSG_TEXT_EMOTE")
|
||||
frame:RegisterEvent("CHAT_MSG_YELL")
|
||||
frame:SetScript("OnEvent", function(self, event, msg, sender, language, channel)
|
||||
if not Heimdall_Data.config.chatSniffer.enabled then return end
|
||||
if not Heimdall_Data.config.chatSniffer.debug then
|
||||
shared.dump(string.format("[%s] got message", { event, msg, sender, language, channel }))
|
||||
end
|
||||
local timestamp = date("%Y-%m-%d %H:%M:%S")
|
||||
local log = string.format(
|
||||
"%s|%s|%s|%s|%s|%s",
|
||||
|
||||
Reference in New Issue
Block a user