Sends a chat message

Signature:

SendChatMessage("text" [, "chatType" [, "language" [, "channel"]]])

Arguments:

  • text - Message to be sent (up to 255 characters) (string)

  • chatType - Channel on which to send the message (defaults to SAY if omitted) (string)

    • BATTLEGROUND - Messages to a battleground raid group (sent with /bg in the default UI)
    • CHANNEL - Message to a server or custom chat channel (sent with /1, /2, etc in the default UI); requires channel number for channel argument
    • DND - Enables Away-From-Keyboard status for the player, with text as the custom message seen by others attempting to whisper the player
    • EMOTE - 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)
    • 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 /e in the default UI); requires name of the character for channel argument
    • YELL - Yell to not-so-nearby players (sent with /y in the default UI)

  • language - Language in which to send the message; defaults to Common (for Alliance players) or Orcish (for Horde players) if omitted (string)

    • COMMON - Alliance and Human language
    • DARNASSIAN - Night Elf Language
    • DRAENEI - Draenei Language
    • DWARVEN - Dwarf Language
    • GNOMISH - Gnome language
    • GUTTERSPEAK - Undead language
    • ORCISH - Horde and Orc Language
    • TAURAHE - Tauren Language
    • THALASSIAN - Night Elf Language
    • TROLL - Troll language

  • channel - If chatType is WHISPER, name of the target character; if chatType is 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)