Implement joingroup and leavegroup for commander

This commit is contained in:
2025-01-05 23:32:46 +01:00
parent 6059c16a6e
commit aa46000abf

View File

@@ -146,6 +146,25 @@ function shared.Commander.Init()
end
local function HelpRu() return helpMessages.ru end
local function HelpEn() return helpMessages.en end
local groupInviteFrame = CreateFrame("Frame")
groupInviteFrame:SetScript("OnEvent", function(self, event, ...)
AcceptGroup()
groupInviteFrame:UnregisterEvent("PARTY_INVITE_REQUEST")
C_Timer.NewTimer(0.1, function()
_G["StaticPopup1Button1"]:Click()
end, 1)
end)
local function JoinGroup()
groupInviteFrame:RegisterEvent("PARTY_INVITE_REQUEST")
C_Timer.NewTimer(10, function()
groupInviteFrame:UnregisterEvent("PARTY_INVITE_REQUEST")
end, 1)
return { "+" }
end
local function LeaveGroup()
LeaveParty()
return {}
end
---@class Command
---@field keywordRe string
@@ -158,6 +177,8 @@ function shared.Commander.Init()
{ keywordRe = "^classes", commanderOnly = false, callback = CountClassPartitionedStinkies },
{ keywordRe = "^help", commanderOnly = false, callback = HelpRu },
{ keywordRe = "^helpen", commanderOnly = false, callback = HelpEn },
{ keywordRe = "^joingroup", commanderOnly = true, callback = JoinGroup },
{ keywordRe = "^leavegroup", commanderOnly = true, callback = LeaveGroup },
}
local commanderChannelFrame = CreateFrame("Frame")