glyde/payload/allowed_mentions
Who a message is allowed to ping.
Leaving the field off is not neutral: Discord parses and delivers every
mention in the content, so a bot echoing user input pings @everyone the
moment somebody types it. none() is the safe value.
parse and the id lists are mutually exclusive per kind, so
{"parse":["users"],"users":["1"]} is a 400. Each kind is one three-state
value here, so the pair does not exist to be built.
Types
pub opaque type AllowedMentions
Values
pub fn all() -> AllowedMentions
Ping everything the content mentions, as Discord does with no field at all.
That includes the author of a replied-to message, which is the one thing an
absent field does not leave off. ping_reply turns it back down.
pub fn everyone_plus(
users users: List(id.Id(id.User)),
roles roles: List(id.Id(id.Role)),
) -> AllowedMentions
Allow @everyone and @here, plus these ids. A listed user is pinged even if they have muted @everyone.
pub fn mention_policy(
mentions: AllowedMentions,
content content: field.Field(a),
components components: field.Field(b),
) -> field.Field(json.Json)
The allowed_mentions entry for an edit, written only when the edit
touches content or components, which are what Discord re-parses
mentions from. Sending it otherwise breaks suppressing embeds on somebody
else’s message, which Discord refuses it on.
pub fn none() -> AllowedMentions
Ping nobody. The safe default for anything that echoes user input.
pub fn only(
users users: List(id.Id(id.User)),
roles roles: List(id.Id(id.Role)),
) -> AllowedMentions
Ping only these ids, and no @everyone or @here.
pub fn ping_reply(
mentions: AllowedMentions,
enabled: Bool,
) -> AllowedMentions
Independent of the rest: a reply notifies the author even when the content mentions nobody.
pub fn to_json(mentions: AllowedMentions) -> json.Json