View Single Post
07-09-12, 02:31 PM   #9
Wishko
A Murloc Raider
AddOn Author - Click to view addons
Join Date: Sep 2010
Posts: 7
Lua Code:
  1. Button:RegisterEvent("CHAT_MSG_GUILD")
  2. Button:RegisterEvent("CHAT_MSG_OFFICER")
  3. Button:RegisterEvent("CHAT_MSG_BATTLEGROUND")
  4. Button:RegisterEvent("CHAT_MSG_BATTLEGROUND_LEADER")
  5. Button:RegisterEvent("CHAT_MSG_PARTY")
  6. Button:RegisterEvent("CHAT_MSG_RAID_LEADER")
  7. Button:RegisterEvent("CHAT_MSG_RAID")
  8. Button:RegisterEvent("CHAT_MSG_WHISPER")
  9. Button:RegisterEvent("CHAT_MSG_BN_WHISPER")
  10. Button:RegisterEvent("CHAT_MSG_CHANNEL")
  11. Button:RegisterEvent("CHAT_MSG_SAY")
  12.  
  13. Button:SetScript("OnEvent", function(self, event, msg, sender, _, chanString, _, _, _, chanNumber, chanName)
  14.     if message ~= nil then
  15.     local mas = {"!mop","!mists","!pandaria","!panda"}
  16.        for i=1,#mas do
  17.            local startPos, endPos = string.find(msg,mas[i]);
  18.            if startPos ~= nil then
  19.              if string.sub(msg,startPos,endPos) == mas[i] then
  20.                 if chanNumber > 0 then SendChatMessage(Report,"CHANNEL",nil,chanNumber) else SendChatMessage(Report,"GUILD")
  21.                end
  22.              end
  23.            end
  24.          end

I try to use this and can hook/send message to any channel, but I don't know how to distinguish message from SAY from message of GUILD
  Reply With Quote