Skip to main content

Guild

Struct Guild 

Source
#[non_exhaustive]
pub struct Guild {
Show 44 fields pub id: GuildId, pub name: CompactString, pub icon: Option<ImageHash>, pub icon_hash: Option<ImageHash>, pub splash: Option<ImageHash>, pub discovery_splash: Option<ImageHash>, pub owner: bool, pub owner_id: UserId, pub permissions: Option<Permissions>, pub region: Option<CompactString>, pub afk_channel_id: Option<ChannelId>, pub afk_timeout: u32, pub widget_enabled: bool, pub widget_channel_id: Option<ChannelId>, pub verification_level: VerificationLevel, pub default_message_notifications: DefaultMessageNotificationLevel, pub explicit_content_filter: ExplicitContentFilterLevel, pub roles: Vec<Role>, pub emojis: Vec<Emoji>, pub features: Vec<Feature>, pub mfa_level: MfaLevel, pub application_id: Option<ApplicationId>, pub system_channel_id: Option<ChannelId>, pub system_channel_flags: SystemChannelFlags, pub rules_channel_id: Option<ChannelId>, pub max_presences: Option<u32>, pub max_members: Option<u32>, pub vanity_url_code: Option<CompactString>, pub description: Option<CompactString>, pub banner: Option<ImageHash>, pub premium_tier: PremiumTier, pub premium_subscription_count: Option<u32>, pub preferred_locale: Locale, pub public_updates_channel_id: Option<ChannelId>, pub max_video_channel_users: Option<u32>, pub max_stage_video_channel_users: Option<u32>, pub approximate_member_count: Option<u32>, pub approximate_presence_count: Option<u32>, pub welcome_screen: Option<Box<WelcomeScreen>>, pub nsfw_level: AgeRestrictionLevel, pub stickers: Vec<Sticker>, pub premium_progress_bar_enabled: bool, pub safety_alerts_channel_id: Option<ChannelId>, pub incidents_data: Option<Box<IncidentsData>>,
}
Expand description

A guild (called a “server” in the Discord client).

This is the shape returned by GET /guilds/{guild.id} and sent in GUILD_UPDATE. The GUILD_CREATE event carries additional data (members, channels, …) in its own payload type.

discord.js counterpart: Guild.

Fields (Non-exhaustive)§

This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.
§id: GuildId

The guild’s ID.

§name: CompactString

The guild’s name (2-100 characters).

§icon: Option<ImageHash>

The icon hash.

§icon_hash: Option<ImageHash>

The icon hash as sent in guild template objects.

§splash: Option<ImageHash>§discovery_splash: Option<ImageHash>

The discovery splash hash; only for guilds with the DISCOVERABLE feature.

§owner: bool

Whether the current user owns the guild (only in GET /users/@me/guilds).

§owner_id: UserId

The owner’s user ID.

§permissions: Option<Permissions>

The current user’s permissions in the guild, without channel overwrites (only in GET /users/@me/guilds).

§region: Option<CompactString>

The guild’s voice region. Deprecated by Discord: regions are set per voice channel.

§afk_channel_id: Option<ChannelId>

The AFK voice channel.

§afk_timeout: u32

How long a member must be idle before being moved to the AFK channel, in seconds.

§widget_enabled: bool

Whether the server widget is enabled.

§widget_channel_id: Option<ChannelId>

The channel the widget’s invite points to; None when the widget has no invite.

§verification_level: VerificationLevel

What members must have before they can talk in the guild.

§default_message_notifications: DefaultMessageNotificationLevel

The default notification setting for members.

§explicit_content_filter: ExplicitContentFilterLevel

Whose media Discord scans for explicit content.

§roles: Vec<Role>

The guild’s roles.

§emojis: Vec<Emoji>

The guild’s custom emojis.

§features: Vec<Feature>

The guild’s enabled features.

§mfa_level: MfaLevel

Whether moderators need two-factor authentication.

§application_id: Option<ApplicationId>

The application that created the guild, for bot-created guilds.

§system_channel_id: Option<ChannelId>

The channel where welcome messages and boost notices are posted.

§system_channel_flags: SystemChannelFlags

Which notices are not posted in the system channel.

§rules_channel_id: Option<ChannelId>

The rules channel of a Community guild.

§max_presences: Option<u32>

The maximum number of presences (None except for the largest guilds).

§max_members: Option<u32>

The maximum number of members.

§vanity_url_code: Option<CompactString>

The vanity invite code (discord.gg/<code>).

§description: Option<CompactString>

The guild’s description.

§banner: Option<ImageHash>§premium_tier: PremiumTier

The Server Boost level.

§premium_subscription_count: Option<u32>

The number of boosts the guild currently has.

§preferred_locale: Locale

The preferred locale of a Community guild (used in discovery and Discord notices).

§public_updates_channel_id: Option<ChannelId>

The channel where moderators of a Community guild receive notices from Discord.

§max_video_channel_users: Option<u32>

The maximum number of users in a video channel.

§max_stage_video_channel_users: Option<u32>

The maximum number of users in a stage video channel.

§approximate_member_count: Option<u32>

The approximate number of members (GET /guilds/{guild.id}?with_counts=true).

§approximate_presence_count: Option<u32>

The approximate number of online members (with_counts=true).

§welcome_screen: Option<Box<WelcomeScreen>>

The welcome screen of a Community guild (sent with invites).

§nsfw_level: AgeRestrictionLevel

The guild’s age-restriction (NSFW) level. Defaults to Default when absent (older payloads).

§stickers: Vec<Sticker>

The guild’s custom stickers.

§premium_progress_bar_enabled: bool

Whether the boost progress bar is shown.

§safety_alerts_channel_id: Option<ChannelId>

The channel where moderators of a Community guild receive safety alerts.

§incidents_data: Option<Box<IncidentsData>>

Active safety incidents (paused invites or DMs, detected raids or DM spam).

Trait Implementations§

Source§

impl Clone for Guild

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Guild

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for Guild

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Eq for Guild

Source§

impl From<GuildUpdate> for Guild

Source§

fn from(event: GuildUpdate) -> Self

Converts to this type from the input type.
Source§

impl PartialEq for Guild

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl Serialize for Guild

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for Guild

Auto Trait Implementations§

§

impl Freeze for Guild

§

impl RefUnwindSafe for Guild

§

impl Send for Guild

§

impl Sync for Guild

§

impl Unpin for Guild

§

impl UnsafeUnpin for Guild

§

impl UnwindSafe for Guild

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

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

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

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

fn clone_into(&self, target: &mut T)

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

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.