Struct serenity::builder::CreateAllowedMentions[][src]

pub struct CreateAllowedMentions(pub HashMap<&'static str, Value>);
Expand description

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

Examples

use serenity::builder::ParseValue;

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

// Mention all users and the role 182894738100322304
m.allowed_mentions(|am| {
    am.parse(ParseValue::Users);
    am.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);
    am.parse(ParseValue::Roles)
});

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

// Mention everyone and the message author.
m.allowed_mentions(|am| {
    am.parse(ParseValue::Everyone);
    am.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

Performs the conversion.

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

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

Performs the conversion.

Should always be Self

The resulting type after obtaining ownership.

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

🔬 This is a nightly-only experimental API. (toowned_clone_into)

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