fn say(ctx: &mut Context, msg: &Message, args: Args) -> CommandResult {
    let settings = if msg.guild_id.is_some() {
        // By default roles, users, and channel mentions are cleaned.
        ContentSafeOptions::default()
            // We do not want to clean channal mentions as they
            // do not ping users.
            .clean_channel(false)
            // We don't want to clean user mentions, as it was
            // probably intentionally pinging
            .clean_user(false)
    } else {
        ContentSafeOptions::default()
            .clean_channel(false)
            .clean_role(false)
            // We don't want to clean user mentions, as it was probably
            // intentionally pinging
            .clean_user(false)
    };

    let content = content_safe(&ctx.cache, &args.rest(), &settings);

    if let Err(why) = msg.channel_id.say(&ctx.http, &content) {
        println!("Error sending message: {:?}", why);
    }

    Ok(())
}
// Repeats what the user passed as argument but ensures that user and role
// mentions are replaced with a safe textual alternative.
// In this example channel mentions are excluded via the `ContentSafeOptions`.
Repeats what the user passed as argument but ensures that user and role
mentions are replaced with a safe textual alternative.
In this example channel mentions are excluded via the `ContentSafeOptions`.
Repeats what the user passed as argument but ensures that user and role mentions are replaced with a safe textual alternative . In this example channel mentions are excluded via the ` ContentSafeOptions ` .
fn say(ctx: &mut Context, msg: &Message, args: Args) -> CommandResult {
    let settings = if msg.guild_id.is_some() {
        // By default roles, users, and channel mentions are cleaned.
        ContentSafeOptions::default()
            // We do not want to clean channal mentions as they
            // do not ping users.
            .clean_channel(false)
            // We don't want to clean user mentions, as it was
            // probably intentionally pinging
            .clean_user(false)
    } else {
        ContentSafeOptions::default()
            .clean_channel(false)
            .clean_role(false)
            // We don't want to clean user mentions, as it was probably
            // intentionally pinging
            .clean_user(false)
    };
    let content = content_safe(&ctx.cache, &args.rest(), &settings);
    if let Err(why) = msg.channel_id.say(&ctx.http, &content) {
        println!("Error sending message: {:?}", why);
    }
    Ok(())
}
fn say ( ctx : & mut Context , msg : & Message , args : Args ) -> CommandResult { let settings = if msg . guild_id . is_some ( ) { // By default roles, users, and channel mentions are cleaned. ContentSafeOptions :: default ( ) // We do not want to clean channal mentions as they // do not ping users. . clean_channel ( false ) // We don't want to clean user mentions, as it was // probably intentionally pinging . clean_user ( false ) } else { ContentSafeOptions :: default ( ) . clean_channel ( false ) . clean_role ( false ) // We don't want to clean user mentions, as it was probably // intentionally pinging . clean_user ( false ) } ; let content = content_safe ( & ctx . cache , & args . rest ( ) , & settings ) ; if let Err ( why ) = msg . channel_id . say ( & ctx . http , & content ) { println ! ( " " why ) ; } Ok ( ( ) ) }
Repeats what the user passed as argument but ensures that user and role
mentions are replaced with a safe textual alternative.
Repeats what the user passed as argument but ensures that user and role mentions are replaced with a safe textual alternative .
ctx
&mut Context
msg
&Message
args
Args
ctx
&mut Context
msg
&Message
args
Args