You can use
ChatFrame_AddMessageEventFilter() to modify incoming messages.
Lua Code:
ChatFrame_AddMessageEventFilter("CHAT_MSG_GUILD",function(self,event,msg,...)
-- Do something with message
return false,msg,...;-- True blocks the message from displaying, if changing any event args, we need to return all of them
end);