-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSlashCommands.lua
More file actions
69 lines (63 loc) · 2.49 KB
/
SlashCommands.lua
File metadata and controls
69 lines (63 loc) · 2.49 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
------------------------------------------
-- Slash Commands Module
------------------------------------------
local MageService = MAGESERVICE
local Settings = MageService.Settings
------------------------------------------
-- Create the SlashCommands module
------------------------------------------
local SlashCommands = {}
------------------------------------------
-- Command Handler
------------------------------------------
local function HandleCommand(msg)
msg = string.lower(msg or "")
if msg == "on" then
Settings.SetAddonEnabled(true)
print("|cFF33FF99MageService:|r |cFF00FF00Enabled|r")
elseif msg == "off" then
Settings.SetAddonEnabled(false)
print("|cFF33FF99MageService:|r |cFFFF0000Disabled|r")
elseif msg == "show" then
if MageService.ContainerUI then
MageService.ContainerUI.Show()
print("|cFF33FF99MageService:|r UI shown")
end
elseif msg == "hide" then
if MageService.ContainerUI then
MageService.ContainerUI.Hide()
print("|cFF33FF99MageService:|r UI hidden")
end
elseif msg == "help" then
print("|cFF33FF99MageService Commands:|r")
print("|cFFFFFFFF/mageservice|r or |cFFFFFFFF/ms|r - Toggle addon on/off")
print("|cFFFFFFFF/mageservice on|r - Enable addon")
print("|cFFFFFFFF/mageservice off|r - Disable addon")
print("|cFFFFFFFF/mageservice show|r - Show UI container")
print("|cFFFFFFFF/mageservice hide|r - Hide UI container")
print("|cFFFFFFFF/mageservice help|r - Show this help message")
else
-- Toggle if no specific command
local addonEnabled = not Settings.IsAddonEnabled()
Settings.SetAddonEnabled(addonEnabled)
if addonEnabled then
print("|cFF33FF99MageService:|r |cFF00FF00Enabled|r")
else
print("|cFF33FF99MageService:|r |cFFFF0000Disabled|r")
end
end
end
------------------------------------------
-- Initialize Module
------------------------------------------
function SlashCommands.Initialize()
-- Register slash commands
SLASH_MAGESERVICE1 = "/mageservice"
SLASH_MAGESERVICE2 = "/ms"
SlashCmdList["MAGESERVICE"] = HandleCommand
print("|cFF33FF99MageService:|r Type |cFFFFFFFF/mageservice help|r for available commands")
end
------------------------------------------
-- Register the module in the addon namespace
------------------------------------------
MageService.SlashCommands = SlashCommands