Struct serenity::builder::EditGuild[][src]

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

A builder to optionally edit certain fields of a Guild. This is meant for usage with Guild::edit.

Note: Editing a guild requires that the current user have the Manage Guild permission.

Tuple Fields

0: HashMap<&'static str, Value>

Implementations

Set the “AFK voice channel” that users are to move to if they have been AFK for an amount of time, configurable by Self::afk_timeout.

The given channel must be either some valid voice channel, or None to not set an AFK channel. The library does not check if a channel is valid.

Set the amount of time a user is to be moved to the AFK channel - configured via Self::afk_channel - after being AFK.

Set the icon of the guild. Pass None to remove the icon.

Examples

Using the utility function - utils::read_image - to read an image from the cwd and encode it in base64 to send to Discord.

use serenity::utils;

// assuming a `guild` has already been bound

let base64_icon = utils::read_image("./guild_icon.png")?;

guild.edit(&http, |mut g| g.icon(Some(&base64_icon))).await?;

Set the name of the guild.

Note: Must be between (and including) 2-100 chracters.

Set the description of the guild.

Note: Requires that the guild have the DISCOVERABLE feature enabled. You can check this through a guild’s features list.

Set the features of the guild.

Note: Requires that the guild have the DISCOVERABLE feature enabled. You can check this through a guild’s features list.

Transfers the ownership of the guild to another user by Id.

Note: The current user must be the owner of the guild.

👎 Deprecated:

Regions are now set per voice channel instead of globally.

Set the voice region of the server.

Examples

Setting the region to Region::UsWest:

use serenity::model::guild::Region;

// assuming a `guild` has already been bound

guild.edit(&http, |g| g.region(Region::UsWest)).await?;

Set the splash image of the guild on the invitation page.

The splash must be base64-encoded 1024x1024 png/jpeg/gif image-data.

Requires that the guild have the INVITE_SPLASH feature enabled. You can check this through a guild’s features list.

Set the splash image of the guild on the discovery page.

The splash must be base64-encoded 1024x1024 png/jpeg/gif image-data.

Requires that the guild have the DISCOVERABLE feature enabled. You can check this through a guild’s features list.

Set the banner image of the guild, it appears on the left side-bar.

The banner must be base64-encoded 16:9 png/jpeg image data.

Requires that the guild have the BANNER feature enabled. You can check this through a guild’s features list.

Set the channel ID where welcome messages and boost events will be posted.

Set the channel ID of the rules and guidelines channel.

Note: This feature is for Community guilds only.

Set the channel ID where admins and moderators receive update messages from Discord.

Note: This feature is for Community guilds only.

Set the preferred locale used in Server Discovery and update messages from Discord.

If this is not set, the locale will default to “en-US”;

Note: This feature is for Community guilds only.

Set the content filter level.

Set the default message notification level.

Set the verification level of the guild. This can restrict what a user must have prior to being able to send messages in a guild.

Refer to the documentation for VerificationLevel for more information on each variant.

Examples

Setting the verification level to High:

use serenity::model::guild::VerificationLevel;

// assuming a `guild` has already been bound

let edit = guild.edit(&http, |g| g.verification_level(VerificationLevel::High)).await;

if let Err(why) = edit {
    println!("Error setting verification level: {:?}", why);
}

Modifies the notifications that are sent by discord to the configured system channel.

use serenity::model::guild::SystemChannelFlags;

// assuming a `guild` has already been bound

let edit = guild
    .edit(&http, |g| {
        g.system_channel_flags(
            SystemChannelFlags::SUPPRESS_JOIN_NOTIFICATIONS
                | SystemChannelFlags::SUPPRESS_GUILD_REMINDER_NOTIFICATIONS,
        )
    })
    .await;

if let Err(why) = edit {
    println!("Error setting verification level: {:?}", why);
}

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