Guild is the representation of a server (guild) in the client cache. Created from ApiGuild when the GUILD_CREATE event is received.
Fields
| Field | Type | Description |
|---|---|---|
id | Snowflake | Unique guild identifier. |
name | String | Guild name. |
icon | Option<String> | Icon hash. |
banner | Option<String> | Banner hash. |
splash | Option<String> | Invite splash image hash. |
owner_id | Snowflake | ID of the guild owner. |
features | Vec<String> | List of enabled guild features. |
verification_level | u8 | Verification level (0–4). |
mfa_level | u8 | 2FA requirement for moderators (0–1). |
nsfw_level | Option<u32> | Guild NSFW level. |
explicit_content_filter | u8 | Explicit content filter (0–2). |
default_message_notifications | u8 | Default notification level (0 - all, 1 - mentions only). |
system_channel_id | Option<Snowflake> | Channel for system messages. |
system_channel_flags | Option<u32> | System channel flags. |
rules_channel_id | Option<Snowflake> | Rules channel (for Community guilds). |
afk_channel_id | Option<Snowflake> | AFK voice channel. |
afk_timeout | Option<u32> | AFK timeout in seconds. |
vanity_url_code | Option<String> | Custom invite URL code. |
permissions | Option<String> | Bot permissions in the guild (bitfield string). |
roles | HashMap<Snowflake, Role> | Guild role cache. Populated after fetch_roles. |
channels | Vec<Snowflake> | Channel IDs in the guild. |
emojis | Vec<Snowflake> | Emoji IDs in the guild. |
member_count | Option<u64> | Member count. Not always available. |
Constructors
Guild::from_api
Guild from an API response. The roles, channels, and emojis fields are initialized empty - populate them with separate requests as needed.
Guild::from_id
Methods
CDN
None if the hash is absent. For animated icons (hash starts with a_) the extension is automatically set to gif.
CdnOptions lets you specify size and format:
| Field | Type | Description |
|---|---|---|
size | Option<u32> | Image size in pixels (power of two). |
extension | Option<String> | File format ("png", "webp", "jpg"). Defaults to "png". |
Edit and delete
edit
delete
transfer_ownership
Channels
create_channel
fetch_channels
set_channel_positions
Example: create a text channel
Example: create a text channel
Members
fetch_member
fetch_members
limit - max entries, after - pagination by ID.
kick
Bans
ban
unban
fetch_bans
Example: ban and list bans
Example: ban and list bans
Roles
fetch_roles
guild.roles field.
create_role
add_role_to_member / remove_role_from_member
set_role_positions
resolve_role_id
guild.roles by ID or by name. Returns the ID if found. Requires fetch_roles to have been called first.
Example: create a role and assign it to a member
Example: create a role and assign it to a member
Emoji
fetch_emojis / fetch_emoji
create_emoji
image is a data URI in the format data:image/png;base64,....
bulk_create_emojis
Stickers
fetch_stickers / create_sticker
Invites and webhooks
fetch_invites
fetch_webhooks
fetch_vanity_url
Audit log
fetch_audit_logs
Fluxer-specific settings
| Method | Description |
|---|---|
set_text_channel_flexible_names | Enables or disables flexible text channel names. |
set_detached_banner | Controls the guild’s detached banner. |
set_disallow_unclaimed_accounts | Prevents unactivated accounts from joining the guild. |
