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
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:
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,....
