I have this addon code to test C_ChatInfo.SendAddonMessage in World of Warcraft Classic:
local frame = CreateFrame("Frame"); frame:RegisterEvent("CHAT_MSG_CHANNEL"); frame:RegisterEvent("CHAT_MSG_ADDON"); frame:RegisterEvent("CHAT_MSG_WHISPER");
frame:SetScript("OnEvent",
function(self, event, ...)
local player_name = UnitName("Player")
local payload, source_name = ...
print(player_name ..', you received an addon payload from ' .. source_name .. ": " .. payload)
end)
And it works if I use for example the following command:
/script C_ChatInfo.SendAddonMessage("ello", "ello", "SAY")
I’ll receive a message that I got an addon message, but if I change the channel type to “WHISPER” and add my own name or have someone else write that command with my name, I don’t receive anything. BUT, the SendAddonMessage does return true!
Any idea why the “WHISPER” type might work differently?
(I registered the other event types to see if it was maybe being sent under another event)
Update: If I misspell my name it does reply with yellow system text “No player named ‘…’ is currently playing.” So things seem to be happening, but where does my event go? 