Print item links posted in chat channels to chatframe

You can use this snippet to capture item links that are posted in public channels, and print them to the chat frame.

Snippet

if not ItemCatchFrame then
   ItemCatchFrame = CreateFrame("Frame")
end

local frame = ItemCatchFrame
frame:RegisterEvent("CHAT_MSG_CHANNEL")
frame:SetScript("OnEvent", function(self, event, ...)
      local msg, user = ...
      for itemLink in msg:gmatch("|%x+|Hitem:.-|h.-|h|r") do
         print("item link posted by " .. user .. ": " .. itemLink)
      end
end)
Posted by jnwhiteh at Mon, 27 Apr 2009 10:48:09 +0000