DeclineGroup

From Warcraft Wiki
Jump to navigation Jump to search
Flavors
Links
Info
Added in 1.0.0 / 1.13.2

Declines an invitation to a group.

DeclineGroup()

Example

The following snippet auto-declines invitations from characters whose names contain Ghost.

local frame = CreateFrame("FRAME")
frame:RegisterEvent("PARTY_INVITE_REQUEST")
frame:SetScript("OnEvent", function(self, event, sender)
	if sender:match("Ghost") then
	     DeclineGroup()
	end
end)

Details

  • You can use this after recieving the PARTY_INVITE_REQUEST event. If there is no invitation to a party, this function doesn't do anything.
  • Calling this function does NOT cause the "accept/decline dialog" to go away. Use StaticPopup_Hide("PARTY_INVITE") to hide the dialog.
    Depending on the order events are dispatched in, your event handler may run before UIParent's, and therefore attempt to hide the dialog before it is shown. Delaying the attempt to hide the popup until PARTY_MEMBERS_CHANGED resolves this.