Advertisement
ScratchMonkey

DeclineSpamChannelInvitations WoW addon

Nov 4th, 2019
258
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.77 KB | None | 0 0
  1. -- DeclineSpamChannelInvitations
  2.  
  3. local dsciFrame = CreateFrame("Frame")
  4.  
  5. dsciFrame:SetScript("OnEvent", function(self, event, channelID, name)
  6.       if ("CHANNEL_INVITE_REQUEST" == event) then
  7.          print("DeclineSpamChannelInvitations:", self, event, channelID, name)
  8.          if string.find(channelID, "GOLD") then
  9.             print("Spammer " .. name .. "invited you to channel " .. channelID)
  10.             DeclineChannelInvite(channelID)
  11.             return
  12.          end
  13.          -- for all other channels, invoke default handler
  14.          UIParent_OnEvent(UIParent, event, channelID, name)
  15.       end
  16.    end
  17. )
  18.  
  19. dsciFrame:RegisterEvent("CHANNEL_INVITE_REQUEST")
  20.  
  21. -- uncomment this once we know above is working
  22. -- UIParent::UnregisterEvent("CHANNEL_INVITE_REQUEST")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement