→ WoW API
Sends a chat message.
SendChatMessage("msg" [,"chatType" [,languageID [,"channel"]]]);
- String - The message to be sent, maximum length of 255 characters. (Not all characters in this string are allowed: See list of valid chat message characters)
- String - (Optional) The type of chat message to be sent, "SAY", "PARTY", etc. See the list of chatTypeIds.
- If chatType is nil or omitted then "SAY" will be used.
- Number - (Optional) The languageID used to translate the message.
- If languageID is nil or omitted the default language will be used: Orcish for the Horde, and Common for the Alliance, as returned by GetDefaultLanguage("player").
- String - The channel or player receiving the message for "CHANNEL"/"WHISPER" communication. If sending to a channel you must use the number (eg. "1"); obtain it using GetChannelName("channelName"). This field is required for the "CHANNEL"/"WHISPER" chat types and ignored for any other chat type.
SendChatMessage("Hello Bob!", "WHISPER", 7, "Bob");
- To [Bob]: Hello Bob!
local s = "Hello World" local index = GetChannelName("General") -- It finds General is a channel at index 1 if (index~=nil) then SendChatMessage(s , "CHANNEL", nil, index); end
- [1. General - Current Zone Name][Bob]: Hello World
- Sends a chat message of the specified in 'msg' (ex. "Hey!"), to the system specified in 'chatType' ("SAY", "WHISPER", "EMOTE", "CHANNEL", "PARTY", "INSTANCE_CHAT", "GUILD", "OFFICER", "YELL", "RAID", "RAID_WARNING", "AFK", "DND"), in the language specified in 'languageID', to the player or channel specified in 'channel'(ex. "1", "Bob").
- "AFK" and "DND" set your AFK or DND auto-reply. To cancel afk/dnd status, send another message to the same 'channel'.
- It should be noted that you must provide a 'language' (be it nil or an actual languageID) before the 'channel' when sending to the "WHISPER" or "CHANNEL" system.
- To send a whisper to the player's selected target, use UnitName("target") as the Channel.
- Patch 1.11.0 added the "RAID_WARNING" system, only usable by the raid leader and raid assistants. The default UI shows messages send via "RAID_WARNING" in big letters on the center of the screen. As of a recent change in patch 2.0.0 this is also available in party and usable by all party member; Please don't abuse this idea.
- Some channels may have restrictions on who may speak in them. For example, in order to speak in the 'World Defense' channel, you must have a PvP rank of 11 or higher.
- Patch 2.0.0 throws an error when trying to speak a language you don't know.
- "Trying to spoof item links will disconnect you." -- directly taken from patch 1.10.0 patch changes. This includes miscontructed link strings of genuine items/spells/tradeskills, such as capitalizing the hex codes for the link colors.
- As of patch 2.4.0 (or 2.3?), you are no longer disconnected when sending over-long messages. The message is silently truncated to 255 characters.
- patch 2.4: Sending 10+ messages at a time resulting in high RTT for the 9+ messages. (se "Discussion" page for more info)
- patch 5.0.4: The language argument (the language name as a string) was replaced with a languageID argument (a unique number for each language).
- patch 5.1.0: added the "INSTANCE_CHAT" channel, and removed the "BATTLEGROUND" channel