Skip to content

Standard Elements

Basic Elements

Basic elements are the most common message elements. They can be displayed normally on most platforms and are the fundamental units of messages.

Mention User (at)

ATTRIBUTETYPESCOPEDESCRIPTION
idstring?S/Rtarget user id
namestring?S/Rtarget user name
rolestring?S/Rtarget roke
typestring?S/Rspecial operations, such as all for mentioning all members, here for mentioning online members

The <at> element is used to mention a user or users.

Mention Channel (sharp)

ATTRIBUTETYPESCOPEDESCRIPTION
idstringS/Rtarget channel id
namestring?S/Rtarget channel name

The <sharp> element is used to mention a channel.

Link (a)

ATTRIBUTETYPESCOPEDESCRIPTION
hrefstringS/Rurl of the link

The <a> element is used to display a link. If the platform does not support links, it is recommended to display it in the form of content (href).

Resource Elements

Resource message elements represent resource files in the text. Different platforms have significant differences in their support for resource files. When sending, only src needs to be provided. If a platform does not support a specific resource type, the adapter should replace it with src. If a platform does not support sending resource message elements and other message elements simultaneously, the adapter should send them in multiple messages.

ATTRIBUTETYPESCOPEDESCRIPTION
srcstringS/Rurl of the resource
titlestring?S/Rname of the resource file
cache experimentalboolean?Swhether to use cached files
timeout experimentalnumber?Smaximum time to download the file (in milliseconds)

Image (img)

In addition to the common attributes above, the following attributes are supported:

ATTRIBUTETYPESCOPEDESCRIPTION
widthnumber?Rimage width (in pixels)
heightnumber?Rimage width (in pixels)

The <img> element is used to represent an image.

Audio (audio)

In addition to the common attributes above, the following attributes are supported:

ATTRIBUTETYPESCOPEDESCRIPTION
Attributenumber?S/Raudio length (in seconds)
posterstring?S/Rurl of the audio cover

The <audio> element is used to represent audio.

Video (video)

In addition to the common attributes above, the following attributes are supported:

ATTRIBUTETYPESCOPEDESCRIPTION
widthnumber?Rvideo width (in pixels)
heightnumber?Rvideo width (in pixels)
Attributenumber?S/Rvideo length (in seconds)
posterstring?S/Rurl of the video cover

The <video> element is used to represent a video.

File (file)

In addition to the common attributes above, the following attributes are supported:

ATTRIBUTETYPESCOPEDESCRIPTION
posterstring?S/Rurl of the thumbnail

The <file> element is used to represent a file.

Decorative Elements

Decorative elements are used to modify their content. If the corresponding platform does not support the element, the element itself can be ignored, and its child elements can be rendered normally.

Bold (b, strong)

The <b> or <strong> element is used to display its content in bold.

Italic (i, em)

The <i> or <em> element is used to display its content in italics.

Underline (u, ins)

The <u> or <ins> element is used to underline its content.

Strikethrough (s, del)

The <s> or <del> element is used to strikethrough its content.

Spoiler (spl)

The <spl> element is used to mark its content as a spoiler (hidden by default, revealed upon clicking).

Code (code)

The <code> element is used to display its content in a monospaced font (usually with a specific background color).

Superscript (sup)

The <sup> element is used to display its content as superscript.

Subscript (sub)

The <sub> element is used to display its content as subscript.

Layout Elements

Line Break (br)

The <br> element represents an independent line break.

Paragraph (p)

The <p> element represents a paragraph. When rendering, it ensures a line break between itself and adjacent elements.

Message (message)

ATTRIBUTETYPESCOPEDESCRIPTION
idstring?Smessage id
forwardboolean?Swhether it is a forwarded messasge

The basic usage of the <message> element is to represent a message. Its child elements correspond to the message's content. If it has no child elements, the message will not be sent.

When a <message> element appears, the preceding elements are immediately treated as a message and sent. Therefore, the following two approaches are equivalent:

html
<!-- First approach: Send two messages -->
<message>hello</message>
<message>world</message>

<!-- Second approach: Use an empty message to separate two pieces of text, but it still sends two messages -->
hello<message/>world

Some platforms allow you to simulate messages sent by other users:

html
<message>
  <author id="123123123" name="Alice" avatar="url"/>
  hello world
</message>

On platforms that support forwarding, you can use forward with the id attribute to forward a message:

html
<message id="123456789" forward/>

On platforms that support combined forwarding, you can use the <message> element with the forward attribute to nest other <message> elements for combined forwarding:

html
<message forward>
  <message id="123456789"/>
  <message id="987654321"/>
  <!-- You can also nest simulated messages from other users in combined forwarding -->
  <message>
    <author id="123123123" name="Alice" avatar="url"/>
    hello world
  </message>
</message>

Meta Elements

Meta elements are usually not rendered but affect the behavior of message sending.

Quote (quote)

The <quote> element is used to represent a message quote. Its child elements will be rendered as the quoted content. In theory, all features of the <message> element can also be used in the <quote> element, including child elements (to construct quoted messages) and the forward attribute (to quote combined forwarding). However, currently, no platform seems to support this.

Author (author)

ATTRIBUTETYPESCOPEDESCRIPTION
idstring?Suser id
namestring?Suser name
avatarstring?Savatar url

The <author> element is used to represent the author of a message. Its child elements will be rendered as the author's name.

Interactive Elements

Interactive elements are used to display interactive content in messages. If the platform does not support such elements and cannot provide a fallback, the entire element can be ignored. The implementation should return messages with or without interactivity based on platform features.

Button (button) experimental

ATTRIBUTETYPESCOPEDESCRIPTION
idstring?Sbutton id
typestring?Sbutton type
linkstring?Sbutton link
textstring?Stext to input
themestring?Sbutton style

The <button> element is used to represent a button. Its child elements will be rendered as the button's text.

Buttons currently support three different types:

  • Clicking an action button triggers an interaction/button event, and the button resource of the event will contain the above id.
  • Clicking a link button opens a link, and the link's address is the above href.
  • Clicking an input button fills the user's input box with the above text.

theme is recommended to use only the following values:

  • primary
  • secondary
  • success
  • warning
  • danger
  • info