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 toSAY
if omitted) (string
)CHANNEL
- Message to a server or custom chat channel (sent with/1
,/2
, etc in the default UI); requires channel number forchannel
argumentDND
- Enables Away-From-Keyboard status for the player, withtext
as the custom message seen by others attempting to whisper the playerEMOTE
- Custom text emotes visible to nearby players (sent with/e
in the default UI)GUILD
- Messages to guild members (sent with/g
in the default UI)INSTANCE_CHAT
- Messages to a LFG/LFR instance group (sent with/i
in the default UI)OFFICER
- Messages to guild officers (sent with/o
in the default UI)PARTY
- Messages to party members (sent with/p
in the default UI)RAID
- Messages to raid members (sent with/ra
in the default UI)RAID_WARNING
- Warning to raid members (sent with/rw
in the default UI)SAY
- Speech to nearby players (sent with/s
in the default UI)WHISPER
- Message to a specific character (sent with/w
in the default UI); requires name of the character forchannel
argumentYELL
- Yell to not-so-nearby players (sent with/y
in 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 fromGetLanguageByIndex()
. (number
)channel
- IfchatType
isWHISPER
, name of the target character; ifchatType
isCHANNEL
, 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)