libChat is a library that allows you to modify chat messages without taking control of the entire message.
With libChat, your addon can modify the sender's name, the text, or the formatting of the message.
To use libChat (requires libStub), include libChat.lua with your addon and add
Code:
local LC = LibStub('libChat-1.0')
near the top of your code.
To register with libChat, use one of the following:
Code:
LC:registerName(myFunction)
LC:registerText(myFunction)
LC:registerFormat(myFunction)
where "myFunction" is a function that accepts 3 variables: channel ID code, from name, and text.
When using registerName, you return only the name.
When using registerText, you return only the text.
When using registerFormat, you return a formatted string that will be displayed in the chat window.
Returning nil for any of these will cause the message to not be displayed.
libChat is released under the
BSD 2-clause license.