Search code examples
luaworld-of-warcraft

SendChatMessage is a protected function in 1.13.3?


I'm maintaining an addon that has a feature that uses SendChatMessage. But if I call it, I get the error:

Date: 2020-01-01 12:23:01
ID: 1
Error occured in: AddOn: LunarSphere
Count: 1
Message: Warning: AddOn LunarSphere attempted to call a protected function (UNKNOWN()) which may require interaction.
Debug:
   [C]: ?
   [C]: SendChatMessage()
   LunarSphere\lib\moduleSpeech.lua:1087: RunScript()
   LunarSphere\lib\moduleSpeech.lua:403: CheckCurrentAction()
   LunarSphere\lib\moduleSpeech.lua:202:
      LunarSphere\lib\moduleSpeech.lua:179
Locals:
None

The code in question is:

SendChatMessage("msg" ,"SAY");

Really, that's it.

I can use /script SendChatMessage("msg" ,"SAY"); in the client though.

Is there a possible workaround? At least for the SAY channel?

Thanks!


Solution

  • Yes, it's a hardware event protected function now, see https://wow.gamepedia.com/API_SendChatMessage

    If you run the script from the chat window it would work, but not anymore in an addon