pub struct CreateAllowedMentions(pub HashMap<&'static str, Value>);
Available on crate feature builder only.
Expand description

A builder to manage the allowed mentions on a message, used by the ChannelId::send_message and ChannelId::edit_message methods.

Examples

use serenity::builder::ParseValue;

// Mention only the user 110372470472613888
m.allowed_mentions(|am| am.empty_parse().users(vec![110372470472613888]));

// Mention all users and the role 182894738100322304
m.allowed_mentions(|am| am.parse(ParseValue::Users).roles(vec![182894738100322304]));

// Mention all roles and nothing else
m.allowed_mentions(|am| am.parse(ParseValue::Roles));

// Mention all roles and users, but not everyone
m.allowed_mentions(|am| am.parse(ParseValue::Users).parse(ParseValue::Roles));

// Mention everyone and the users 182891574139682816, 110372470472613888
m.allowed_mentions(|am| {
    am.parse(ParseValue::Everyone).users(vec![182891574139682816, 110372470472613888])
});

// Mention everyone and the message author.
m.allowed_mentions(|am| am.parse(ParseValue::Everyone).users(vec![msg.author.id]));

Tuple Fields

0: HashMap<&'static str, Value>

Implementations

Add a value that’s allowed to be mentioned.

If users or roles is specified, Self::users and Self::roles will not work.
If you use either, do not specify it’s same type here.

Clear all the values that would be mentioned.

If parse is empty, the message will not mention anyone, unless they are specified on Self::users or Self::roles.

Sets the users that will be allowed to be mentioned.

Makes users unable to be mentioned.

Sets the roles that will be allowed to be mentioned.

Makes roles unable to be mentioned.

Makes the reply mention/ping the user.

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Returns the “default value” for a type. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more

Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Should always be Self

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more