Something like this should work:
Code:
local function TranslateLinks(_, _, message, ...)
local linkType, linkID, linkText = strmatch(message, "|H(.-):(%d+).*%|h[(.+)%]")
if linkType == "item" then
local itemName = GetItemInfo(linkID)
message = gsub(message, linkText, itemName)
end
return false, message, ...
end
local events = {
"CHAT_MSG_BATTLEGROUND",
"CHAT_MSG_BATTLEGROUND_LEADER",
"CHAT_MSG_CHANNEL",
"CHAT_MSG_GUILD",
"CHAT_MSG_OFFICER",
"CHAT_MSG_PARTY",
"CHAT_MSG_PARTY_LEADER",
"CHAT_MSG_RAID",
"CHAT_MSG_RAID_LEADER",
"CHAT_MSG_SAY",
"CHAT_MSG_YELL",
}
for _, event in pairs(events) do
ChatFrame_AddMessageEventFilter(event, TranslateLinks)
end
If the color codes are inside the brackets, the pattern will need to be changed.
You could easily extend it to handle other types of links, though I'm not sure there's a clean way (eg. not tooltip scanning) to get information about quests by their questID, and maybe some other link types.