Originally Posted by Ayantir
Lua Code:
local function ChatMessageChannel(messageType, fromName, text) if messageType == CHAT_CHANNEL_WHISPER then -- Don't zo_strformat UserId's local pstPerson if string.find(from, "@") == nil then pstPerson = zo_strformat(SI_UNIT_NAME, fromName) end d(pstPerson) if (IsFriend(pstPerson)) then d("A friend just whispered you") end end end ZO_ChatSystem_AddEventHandler(EVENT_CHAT_MESSAGE_CHANNEL, ChatMessageChannel)
I didn't checked it, but it should work as intended, no?
|
This function will replace existing event handler, so it can cause conflicts between this and other addons. I'd recommend hooking of the existing event handler.
Lua Code:
local function ChatMessageChannel(messageType, fromName, ...)
if messageType == CHAT_CHANNEL_WHISPER then
if IsFriend(fromName) then
d("A friend just whispered you")
end
end
end
ZO_PreHook(ZO_ChatSystem_GetEventHandlers(), EVENT_CHAT_MESSAGE_CHANNEL, ChatMessageChannel)