Advertisement
Dan-Levi

This addon registers incoming whisper events.

Jul 28th, 2014
222
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.98 KB | None | 0 0
  1. DoMe = LibStub("AceAddon-3.0"):NewAddon("DoMe", "AceConsole-3.0", "AceEvent-3.0")
  2.  
  3. function DoMe:OnInitialize()
  4.     self:Print("OnInitialize")
  5. end
  6.  
  7. DoMe:RegisterChatCommand("dm", "Slash")
  8.  
  9. function DoMe:Slash(input)
  10.     if (input == "?" or input == "") then
  11.         self:Print("This addon registers incoming whisper events.")
  12.         self:Print("Current events:")
  13.         self:Print("followme - You follow the player who's sending whisper.")
  14.         self:Print("leaveparty - If member of a party and you recieve this whisper, you leave the party.")
  15.         self:Print("In order for this addon to work on both sides, it requires that both players have it.")
  16.     end
  17. end
  18.  
  19. function DoMe:OnEnable()
  20.     self:RegisterEvent("CHAT_MSG_WHISPER")
  21. end
  22.  
  23. function DoMe:CHAT_MSG_WHISPER(arg1,w,name,arg4,arg5,guid)
  24.     if (w == "followme") then
  25.         FollowUnit(guid)
  26.         self:Print("Following "..name..".")
  27.     end
  28.     if (w == "leaveparty") then
  29.         LeaveParty()
  30.         self:Print("Leaving party. Requested by "..name..".")
  31.     end
  32. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement