Sends a chat message
See also Chat functions.
Signature:
SendChatMessage("text" [, "chatType" [, languageIndex [, "channel"]]])
Arguments:
- text- Message to be sent (up to 255 characters) (- string)
- chatType- Channel on which to send the message (defaults to- SAYif omitted) (- string)- CHANNEL- Message to a server or custom chat channel (sent with- /1,- /2, etc in the default UI); requires channel number for- channelargument
- DND- Enables Away-From-Keyboard status for the player, with- textas the custom message seen by others attempting to whisper the player
- EMOTE- Custom text emotes visible to nearby players (sent with- /ein the default UI)
- GUILD- Messages to guild members (sent with- /gin the default UI)
- INSTANCE_CHAT- Messages to a LFG/LFR instance group (sent with- /iin the default UI)
- OFFICER- Messages to guild officers (sent with- /oin the default UI)
- PARTY- Messages to party members (sent with- /pin the default UI)
- RAID- Messages to raid members (sent with- /rain the default UI)
- RAID_WARNING- Warning to raid members (sent with- /rwin the default UI)
- SAY- Speech to nearby players (sent with- /sin the default UI)
- WHISPER- Message to a specific character (sent with- /win the default UI); requires name of the character for- channelargument
- YELL- Yell to not-so-nearby players (sent with- /yin the default UI)
 
- languageIndex- Language in which to send the message; defaults to Common (for Alliance players) or Orcish (for Horde players) if omitted. Language indices can be retrieved from- GetLanguageByIndex(). (- number)
- channel- If- chatTypeis- WHISPER, name of the target character; if- chatTypeis- CHANNEL, number identifying the target channel; ignored otherwise (- string)
Examples:
-- Send a chat message to the character the player is currently mousing over
-- This should be run as a macro (via keybind) so your mouse can be hovering
-- over a unit in the 3-D world, or a unit frame
local name = UnitName("mouseover")
SendChatMessage("Hey " .. name .. " I'm mousing over you!!!", "WHISPER", nil, name)
-- This can be run as a macro by putting it all on one line, and adding run
-- in front of it, like so:
--
-- /run local name = UnitName("mouseover"); SendChatMessage("Hey " .. name .. " I'm mousing over you!!!", "WHISPER", nil, name)
