Automated updating of API pages at this location, to reflect patch changes, has ceased from 10.1.7 onwards. |
This function is restricted.
|
Sends a chat message.
SendChatMessage(msg [, chatType, languageID, target])
Arguments[]
- msg
- string - The message to be sent. Large messages are truncated to max 255 characters, and only valid chat message characters are permitted.
- chatType
- string? - The type of message to be sent, e.g.
"PARTY"
. If omitted, this defaults to"SAY"
- languageID
- number? - The languageID used for the message. Only works with chatTypes
"SAY"
and"YELL"
, and only if not in a group. If omitted the default language will be used: Orcish for the Horde and Common for the Alliance, as returned by GetDefaultLanguage() - target
- string|number? - The player name or channel number receiving the message for
"WHISPER"
or"CHANNEL"
chatTypes.
Chat types[]
- HW - denotes if the chatType requires a hardware event when in the outdoor world, i.e. not in an instance/battleground.
chatType | Command | HW | Description |
---|---|---|---|
"SAY" | /s, /say | Chat message to nearby players | |
"EMOTE" | /e, /emote | Custom text emote to nearby players (See DoEmote for normal emotes) | |
"YELL" | /y, /yell | Chat message to far away players | |
"PARTY" | /p, /party | Chat message to party members | |
"RAID" | /ra, /raid | Chat message to raid members | |
"RAID_WARNING" | /rw | Audible warning message to raid members | |
"INSTANCE_CHAT" | /i, /instance | Chat message to the instance group (Dungeon finder / Battlegrounds / Arena) | |
"GUILD" | /g, /guild | Chat message to guild members | |
"OFFICER" | /o, /officer | Chat message to guild officers | |
"WHISPER" | /w, /whisper /t, /tell |
Whisper to a specific other player, use player name as target argument | |
"CHANNEL" | /1, /2, ... | Chat message to a specific global/custom chat channel, use channel number as target argument | |
"AFK" | /afk | Not a real channel; Sets your AFK message. Send an empty message to clear AFK status. | |
"DND" | /dnd | Not a real channel; Sets your DND message. Send an empty message to clear DND status. | |
"VOICE_TEXT" | Sends text-to-speech to the in-game voice chat. |
- ^ The "CHANNEL" chatType is HW event restricted for both outdoors and indoors.
Details[]
- Fires CHAT_MSG_* events, e.g. CHAT_MSG_SAY and CHAT_MSG_CHANNEL
- "RAID_WARNING" is accessible to raid leaders/assistants, or to all members of a party (when not in a raid)
- "WHISPER" works across all realms in a region, it's not restricted to connected realms and you don't need to have interacted with the recipient before.
Example[]
Sends a message, defaults to "SAY".
SendChatMessage("Hello world")
Sends a /yell message.
SendChatMessage("For the Horde!", "YELL"); DoEmote("FORTHEHORDE")
Sends a message to General Chat which is usually on channel index 1
SendChatMessage("Hello friends", "CHANNEL", nil, 1)
Whispers your target.
SendChatMessage("My, you're a tall one!", "WHISPER", nil, UnitName("target"))
Sets your /dnd message.
SendChatMessage("Grabbing a beer", "DND")
Speaks in Thalassian, provided your character knows the language.
SendChatMessage("Ugh, I hate Thunder Bluff! You can't find a good burger anywhere.", "SAY", 10)
Sends a message to an instance group, raid, or party.
SendChatMessage("Hello there o/", IsInGroup(LE_PARTY_CATEGORY_INSTANCE) and "INSTANCE_CHAT" or IsInRaid() and "RAID" or "PARTY")
Patch changes[]
Patch 9.1.0 (2021-06-29): Added "VOICE_TEXT"
Patch 8.2.5 (2019-09-24): Including Patch 1.13.3; Partially protected; "SAY", "YELL" and "CHANNEL" must be triggered by a hardware event [1]
Patch 5.1.0 (2012-11-27): Added "INSTANCE_CHAT" and removed "BATTLEGROUND"
Patch 5.0.4 (2012-08-28): Changed language argument from a string to a numeric languageID
Patch 2.4.0 (2008-03-25): Large messages are truncated to 255 characters and no longer trigger disconnects
Patch 2.0.1 (2006-12-05): Throws an error when attempting to speak a language you don't know
Patch 1.11.0 (2006-06-19): Added "RAID_WARNING" for raid leaders (subsequently available in party mode by all party members circa Patch 2.0)
References[]
- ^ Deadly Boss Mods 2019-09-25. SendChatMessage restrictions. “Ok, a bunch of addon authors got to bottom of it after tons of testing. SendChatMessage automation disabled in public/private chat channels It’s ALSO disabled from SAY/YELL out in world. It’s permitted in raid/party/guild chat, and SAY/YELL within instances.”