Minecraft Wiki
Tag: Visual edit
Line 79: Line 79:
   
 
* To send the message "Hello" in chat:
 
* To send the message "Hello" in chat:
** <code>/tellraw @a "text to display"</code>‌<sup>[''[[Java Edition]] only'']</sup>
+
**<code>/tellraw @a "text to display"</code>‌<sup>[''[[Java Edition]] only'']</sup>
** <code>/tellraw @a{"rawtext":[{"text":"text to display"}]}</code>‌<sup>[''[[Bedrock Edition]] only'']</sup>
+
** <code>/tellraw @a{"rawtext":[{"text":"text to display"}]}</code>‌<sup>[''[[Bedrock Edition]] only'']</sup>
 
* To send the message "I am blue" colored blue in chat:
 
* To send the message "I am blue" colored blue in chat:
** <code>/tellraw @a{"text":"I am blue","color":"blue"}</code>‌<sup>[''[[Java Edition]] only'']</sup>
+
**<code>/tellraw @a{"text":"I am blue","color":"blue"}</code>‌<sup>[''[[Java Edition]] only'']</sup>
** <code>/tellraw @a{"rawtext":[{"text":"§9I am blue"}]}</code>‌<sup>[''[[Bedrock Edition]] only'']</sup>
+
** <code>/tellraw @a{"rawtext":[{"text":"§9I am blue"}]}</code>‌<sup>[''[[Bedrock Edition]] only'']</sup>
 
** If you want to use a hex code:
 
** If you want to use a hex code:
** <code>/tellraw @a{"text":"I am blue","color":"#5555ff"}</code>‌<sup>[''[[Java Edition]] only'']</sup>
+
** <code>/tellraw @a{"text":"I am blue","color":"#5555ff"}</code>‌<sup>[''[[Java Edition]] only'']</sup>
 
* To send the message "Hover me!" in chat, which displays the text "Hi!" when hovered over:
 
* To send the message "Hover me!" in chat, which displays the text "Hi!" when hovered over:
** <code><nowiki>/tellraw @a{"text":"Hover me!","hoverEvent":{"action":"show_text","value":"Hi!"}}</nowiki></code>‌<sup>[''[[Java Edition]] only'']</sup>
+
**<code><nowiki>/tellraw @a{"text":"Hover me!","hoverEvent":{"action":"show_text","value":"Hi!"}}</nowiki></code>‌<sup>[''[[Java Edition]] only'']</sup>
 
* Use '\n' to insert a new line:
 
* Use '\n' to insert a new line:
** <code>/tellraw @a "Text1\nText2"</code>‌<sup>[''[[Java Edition]] only'']</sup>
+
**<code>/tellraw @a "Text1\nText2"</code>‌<sup>[''[[Java Edition]] only'']</sup>
** <code>/tellraw @a{"rawtext":[{"text":"Text1\nText2"}]}</code>‌<sup>[''[[Bedrock Edition]] only'']</sup>
+
** <code>/tellraw @a{"rawtext":[{"text":"Text1\nText2"}]}</code>‌<sup>[''[[Bedrock Edition]] only'']</sup>
 
* Using values in translations
 
* Using values in translations
** <code>/tellraw @a{"rawtext":[{"translate":"chat.type.announcement","with":["value1","value2"]}]}</code>‌ Localization: chat.type.announcement=[%s] %s
+
**<code>/tellraw @a{"rawtext":[{"translate":"chat.type.announcement","with":["value1","value2"]}]}</code>‌ Localization: chat.type.announcement=[%s] %s
   
 
‌<sup>[''[[Bedrock Edition]] only'']</sup>
 
‌<sup>[''[[Bedrock Edition]] only'']</sup>

Revision as of 21:42, 24 May 2021

Sends a JSON message to players.

Syntax

  • Java Edition
tellraw <targets> <message>
  • Bedrock Edition
tellraw <target: target> <raw json message: json>

Arguments

JE<targets>: entity
BE: target: target: CommandSelector<Player>

Specifies the player(s) to send the message to.
Must be a player name, a target selector or a UUID[Java Edition only]. And the target selector must‌[JE only]/should‌[BE only] be of player type.

JE<message>: component
BE: raw json message: json: Json::Value

Specifies the message to send.
Must be a raw JSON text.

Result

Command Trigger Java Edition Bedrock Edition
any the arguments are not specified correctly Unparseable Failed
<targets> or player: target fails to resolve to one or more online players Failed
On success Displays message to the targeted player(s).

Output

Command Edition Situation Success Count /execute store success ... /execute store result ...
any Java Edition On fail 0 0 0
On success 1 1 the number of targeted players
Bedrock Edition On fail 0 N/A N/A
On success 1 N/A N/A

Examples

  • To send the message "Hello" in chat:
  • To send the message "I am blue" colored blue in chat:
    • /tellraw @a {"text":"I am blue","color":"blue"}[Java Edition only]
    • /tellraw @a {"rawtext":[{"text":"§9I am blue"}]}[Bedrock Edition only]
    • If you want to use a hex code:
    • /tellraw @a {"text":"I am blue","color":"#5555ff"}[Java Edition only]
  • To send the message "Hover me!" in chat, which displays the text "Hi!" when hovered over:
    • /tellraw @a {"text":"Hover me!","hoverEvent":{"action":"show_text","value":"Hi!"}}[Java Edition only]
  • Use '\n' to insert a new line:
  • Using values in translations
    • /tellraw @a {"rawtext":[{"translate":"chat.type.announcement","with":["value1","value2"]}]}‌ Localization: chat.type.announcement=[%s] %s

[Bedrock Edition only]

History

For changes to the raw JSON text used by this command, see Raw JSON text format § History.

Java Edition
1.7.2 13w37a Added /tellraw.
Bedrock Edition
1.9.0 beta 1.9.0.0 Added /tellraw.

See also

  • /say — send a plain text message to all players
  • /titleraw - display a JSON-formatted as a title
  • /tell, /msg — send a plain private text message to specific players