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