local addonname, shared = ... ---@cast shared HeimdallShared ---@cast addonname string ---@diagnostic disable-next-line: missing-fields shared.Emoter = {} function shared.Emoter.Init() local frame = CreateFrame("Frame") frame:RegisterEvent("CHAT_MSG_CHANNEL") frame:SetScript("OnEvent", function(self, event, msg, sender, ...) if not Heimdall_Data.config.emoter.enabled then return end local channelId = select(6, ...) local channelname = "" ---@type any[] local channels = { GetChannelList() } for i = 1, #channels, 2 do ---@type number local id = channels[i] ---@type string local name = channels[i + 1] if id == channelId then channelname = name end end if channelname ~= Heimdall_Data.config.emoter.masterChannel then return end if string.find(msg, "^" .. Heimdall_Data.config.emoter.prefix) then local emote = string.sub(msg, string.len(Heimdall_Data.config.emoter.prefix) + 1) DoEmote(emote) end end) print("Heimdall - Emoter loaded") end