Files
coa-chatter/Chatter/Modules/StickyChannels.lua
T
florian.berthold 5eaec81f02 chore: move addon into Chatter/ + add standard .gitignore
Matches the Exiles fork-layout convention (each addon in its own folder).
2026-05-25 10:59:27 +02:00

60 lines
1.4 KiB
Lua

local mod = Chatter:NewModule("Sticky Channels")
local L = LibStub("AceLocale-3.0"):GetLocale("Chatter")
mod.modName = L["Sticky Channels"]
local pairs = _G.pairs
local channels = {
SAY = L["Say"],
EMOTE = L["Emote"],
YELL = L["Yell"],
OFFICER = L["Officer"],
RAID_WARNING = L["Raid Warning"],
WHISPER = L["Whisper"],
BN_WHISPER = L["RealID Whisper"],
CHANNEL = L["Custom channels"]
}
local options = {}
local defaults = {profile = {}}
function mod:OnInitialize()
self.db = Chatter.db:RegisterNamespace("StickyChannels", defaults)
for k, v in pairs(channels) do
defaults.profile[k] = true
options[k] = {
type = "toggle",
name = v,
desc = (L["Make %s sticky"]):format(v),
get = function() return mod.db.profile[k] end,
set = function(info, v)
mod.db.profile[k] = v
ChatTypeInfo[k].sticky = v and 1 or 0
end
}
end
end
function mod:OnEnable()
for k, v in pairs(channels) do
ChatTypeInfo[k].sticky = self.db.profile[k] and 1 or 0
end
end
function mod:OnDisable()
ChatTypeInfo.EMOTE.sticky = 0
ChatTypeInfo.YELL.sticky = 0
ChatTypeInfo.OFFICER.sticky = 0
ChatTypeInfo.RAID_WARNING.sticky = 0
ChatTypeInfo.WHISPER.sticky = 0
ChatTypeInfo.CHANNEL.sticky = 0
ChatTypeInfo.BN_WHISPER.sticky = 0
end
function mod:GetOptions()
return options
end
function mod:Info()
return L["Makes channels you select sticky."]
end