Skip to content

Commit

Permalink
fix slash commands to open settings
Browse files Browse the repository at this point in the history
  • Loading branch information
ollidiemaus committed Jul 24, 2024
1 parent 5e7a667 commit db6ffdd
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
2 changes: 1 addition & 1 deletion AutoPotion.toc
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
## Interface-Classic: 11503
## Interface-WOTLKC: 30403
## Interface-Cata: 40400
## Version: 3.5.0
## Version: 3.5.1
## Title: Auto Potion
## Author: ollidiemaus
## Notes: Updates the Macro AutoPotion to use either Healthstone or the highest Potion found in Bags
Expand Down
14 changes: 10 additions & 4 deletions FrameXML/InterfaceOptionsFrame.lua
Original file line number Diff line number Diff line change
Expand Up @@ -166,14 +166,15 @@ function panel:updatePrio()
end

function panel:InitializeOptions()
self.panel = CreateFrame("Frame", "Auto Potion", InterfaceOptionsFramePanelContainer)
self.panel = CreateFrame("Frame", addonName, InterfaceOptionsFramePanelContainer)
---@diagnostic disable-next-line: inject-field
self.panel.name = "Auto Potion"
self.panel.name = addonName
if InterfaceOptions_AddCategory then
InterfaceOptions_AddCategory(self.panel)
else
local category = Settings.RegisterCanvasLayoutCategory(self.panel, self.panel.name);
local category = Settings.RegisterCanvasLayoutCategory(self.panel, addonName);
Settings.RegisterAddOnCategory(category);
self.panel.categoryID = category:GetID() -- for OpenToCategory use
end

------------- HEADER -------------
Expand Down Expand Up @@ -342,5 +343,10 @@ SLASH_HAM3 = "/ap"
SLASH_HAM4 = "/autopotion"

SlashCmdList.HAM = function(msg, editBox)
InterfaceOptionsFrame_OpenToCategory(panel.panel)
if InterfaceOptions_AddCategory then
InterfaceOptionsFrame_OpenToCategory(addonName)
else
local settingsCategoryID = _G[addonName].categoryID
Settings.OpenToCategory(settingsCategoryID)
end
end

0 comments on commit db6ffdd

Please sign in to comment.