Struct serenity::builder::EditGuild
[−]
[src]
pub struct EditGuild(pub Map<String, Value>);
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.
Methods
impl EditGuild
[src]
fn afk_channel<C: Into<ChannelId>>(self, channel: Option<C>) -> Self
Set the "AFK voice channel" that users are to move to if they have been
AFK for an amount of time, configurable by 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.
fn afk_timeout(self, timeout: u64) -> Self
Set the amount of time a user is to be moved to the AFK channel -
configured via afk_channel
- after being AFK.
fn icon(self, icon: Option<&str>) -> Self
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(|g| g.icon(Some(&base64_icon)))?;
fn name(self, name: &str) -> Self
Set the name of the guild.
Note: Must be between (and including) 2-100 chracters.
fn owner<U: Into<UserId>>(self, user_id: U) -> Self
Transfers the ownership of the guild to another user by Id.
Note: The current user must be the owner of the guild.
fn region(self, region: Region) -> Self
Set the voice region of the server.
Examples
Setting the region to Region::UsWest
:
use serenity::model::Region; // assuming a `guild` has already been bound guild.edit(|g| g.region(Region::UsWest))?;
fn splash(self, splash: Option<&str>) -> Self
Set the splash image of the guild on the invitation page.
Requires that the guild have the InviteSplash
feature enabled.
You can check this through a guild's features
list.
fn verification_level<V>(self, verification_level: V) -> Self where
V: Into<VerificationLevel>,
V: Into<VerificationLevel>,
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::VerificationLevel; // assuming a `guild` has already been bound if let Err(why) = guild.edit(|g| g.verification_level(VerificationLevel::High)) { println!("Error setting verification level: {:?}", why); } // additionally, you may pass in just an integer of the verification // level if let Err(why) = guild.edit(|g| g.verification_level(3)) { println!("Error setting verification level: {:?}", why); }
Trait Implementations
impl Clone for EditGuild
[src]
fn clone(&self) -> EditGuild
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0
Performs copy-assignment from source
. Read more