[id, isRole] pair in SendOptions.mentions. These helpers build and read both halves. For the model and the patterns, see Mentions and replies.
userMention
id, and normalizes dashed uuids to undashed lowercase hex.
The text alone renders a pill and notifies nobody. Pass
mentions too, or the ping does not happen.roleMention
@Name. Roles are still name-keyed on the wire, so the pill renders only for viewers whose client resolves that role name, and renaming the role stops old messages from rendering it. The ping itself rides the id pair and is unaffected.
Multi-word role names work, because clients match them longest first. Single-word names must match [\w-]+ to render as a pill.
Role,
@everyone and @here pings are gated server-side on mention_roles. client.can('mention_roles', serverId) is an advisory pre-check, and the server remains authoritative.mentionPairs
send() calls this for you on SendOptions.mentions, so you rarely call it directly. Reach for it when you are building a frame yourself with client.raw.
The pairs it produces:
Ids may be passed dashed or undashed. The backend validates direct mention ids as uuids and silently discards targets that are not members of the server.
parseMentions
Message.mentions and Message.mentionsMe are produced by this function, and fetched history is populated identically.
@Everyone and @Here are matched case-insensitively, exactly like the clients.
EVERYONE and HERE
MENTION_ENTITY_RE
Types
MentionTarget
SendOptions.mentions accepts. Ids may be dashed or undashed.
MentionPair
1 for a role and 0 for everything else.
MessageMentions
WhatparseMentions() returns, and the shape of Message.mentions.
string[]
Normalized (undashed, lowercase) ids of the user-mention entities in the body.
string[]
Literal
@name tokens that are neither @everyone, @here, nor an id entity. A name may be a role, an older-format user mention, or just text. The SDK cannot tell them apart without the server’s role list.boolean
The body contains
@everyone, case-insensitively.boolean
The body contains
@here, case-insensitively.Message.mentionsMe covers direct mentions only. A role mention cannot be resolved to “this means me”: the SDK does not know which roles the bot holds, because permission verdicts carry an effective rank rather than role ids. Compare names against guild(serverId).fetchRoles() if you need that.Next
Mentions and replies
The two-part model, and true replies.
Sending messages
Where
SendOptions is documented.Encryption lanes
What leaves the encrypted envelope, and why.
Types
Message, SendOptions, and the rest.