Skip to main content
Guild is the representation of a server (guild) in the client cache. Created from ApiGuild when the GUILD_CREATE event is received.

Fields


Constructors

Guild::from_api

Creates a Guild from an API response. The roles, channels, and emojis fields are initialized empty - populate them with separate requests as needed.

Guild::from_id

Creates an empty stub by ID. Use when you need a structure without data.

Methods

CDN

Returns image URLs for the guild. 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:

Edit and delete

edit

Updates guild settings. Pass only the fields you want to change.

delete

Deletes the guild. Owner only.

transfer_ownership

Transfers guild ownership to another user.

Channels

create_channel

Creates a channel in the guild.

fetch_channels

Returns the list of all channels in the guild.

set_channel_positions

Sets channel ordering.

Members

fetch_member

Returns a guild member by user ID.

fetch_members

Returns a list of members. limit - max entries, after - pagination by ID.

kick

Kicks a member from the guild.

Bans

ban

Bans a user.

unban

Lifts a ban.

fetch_bans

Returns the list of active bans in the guild.

Roles

fetch_roles

Fetches guild roles and updates the guild.roles field.

create_role

Creates a new role.

add_role_to_member / remove_role_from_member

Assigns or removes a role from a member.

set_role_positions

Sets the role order.

resolve_role_id

Looks up a role in guild.roles by ID or by name. Returns the ID if found. Requires fetch_roles to have been called first.

Emoji

fetch_emojis / fetch_emoji

Returns all guild emoji or a specific one.

create_emoji

Creates a custom emoji. image is a data URI in the format data:image/png;base64,....

bulk_create_emojis

Creates multiple emoji in a single call. Errors for individual emoji are ignored - only successfully created ones are returned.

Stickers

fetch_stickers / create_sticker


Invites and webhooks

fetch_invites

fetch_webhooks

fetch_vanity_url

Returns the guild’s custom invite URL.

Audit log

fetch_audit_logs

Returns audit log entries.

Fluxer-specific settings

Guild settings specific to Fluxer with no Discord API equivalent.