1
0
mirror of https://github.com/brues-code/TwitchEmotes.git synced 2026-09-22 07:36:58 +00:00
Files
TwitchEmotes/CAPI_Warning.lua
Brues 4173e827eb Warn instead of loading when ClassicAPI is missing
The addon needs the ClassicAPI DLL - without it the inline |T markup the
emotes are built from renders as literal text, title included. Move the
real load order into TwitchEmotes_ClassicAPI.toc, which the DLL picks up
in preference, and leave the base TOC loading nothing but CAPI_Warning.lua:
a popup and a chat line pointing at the latest release, with the download
URL in a preselected edit box. Its title drops the inline-texture markup
for the same reason.

Also list CreateFrame among the globals in .luarc.json.
2026-09-03 16:05:02 -05:00

39 lines
1.2 KiB
Lua

local CLASSIC_API_WEBSITE = "https://github.com/brues-code/ClassicAPI"
local CLASSIC_API_LATEST_URL = CLASSIC_API_WEBSITE .. "/releases/latest"
local headline = "TwitchEmotes has been disabled."
local detail = "The ClassicAPI DLL isn't loaded. Download the latest release from: "
local function ShowRequiredPopup()
StaticPopupDialogs["TWITCH_CLASSICAPI_REQUIRED"] = {
text = headline .. "\n\n" .. detail,
button1 = OKAY,
hasEditBox = 1,
editBoxWidth = 280,
timeout = 0,
whileDead = 1,
hideOnEscape = 1,
preferredIndex = 3,
OnShow = function()
local editBox = getglobal(this:GetName().."EditBox")
if editBox then
editBox:SetText(CLASSIC_API_LATEST_URL)
editBox:HighlightText()
editBox:SetFocus()
end
end,
}
StaticPopup_Show("TWITCH_CLASSICAPI_REQUIRED")
DEFAULT_CHAT_FRAME:AddMessage(
headline .. " " .. detail .. CLASSIC_API_LATEST_URL,
1, 0.3, 0.3
)
end
local loginFrame = CreateFrame("Frame")
loginFrame:RegisterEvent("PLAYER_ENTERING_WORLD")
loginFrame:SetScript("OnEvent", function()
loginFrame:UnregisterEvent("PLAYER_ENTERING_WORLD")
ShowRequiredPopup()
end)