Documentation Index Fetch the complete documentation index at: https://docs.devimorris.tech/llms.txt
Use this file to discover all available pages before exploring further.
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 idSnowflakeUnique guild identifier. nameStringGuild name. iconOption<String>Icon hash. bannerOption<String>Banner hash. splashOption<String>Invite splash image hash. owner_idSnowflakeID of the guild owner. featuresVec<String>List of enabled guild features. verification_levelu8Verification level (0–4). mfa_levelu82FA requirement for moderators (0–1). nsfw_levelOption<u32>Guild NSFW level. explicit_content_filteru8Explicit content filter (0–2). default_message_notificationsu8Default notification level (0 - all, 1 - mentions only). system_channel_idOption<Snowflake>Channel for system messages. system_channel_flagsOption<u32>System channel flags. rules_channel_idOption<Snowflake>Rules channel (for Community guilds). afk_channel_idOption<Snowflake>AFK voice channel. afk_timeoutOption<u32>AFK timeout in seconds. vanity_url_codeOption<String>Custom invite URL code. permissionsOption<String>Bot permissions in the guild (bitfield string). rolesHashMap<Snowflake, Role>Guild role cache. Populated after fetch_roles. channelsVec<Snowflake>Channel IDs in the guild. emojisVec<Snowflake>Emoji IDs in the guild. member_countOption<u64>Member count. Not always available.
Constructors
Guild::from_api
pub fn from_api ( data : & ApiGuild ) -> Self
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
pub fn from_id ( id : impl Into < Snowflake >) -> Self
Creates an empty stub by ID. Use when you need a structure without data.
Methods
CDN
pub fn icon_url ( & self , opts : & CdnOptions ) -> Option < String >
pub fn banner_url ( & self , opts : & CdnOptions ) -> Option < String >
pub fn splash_url ( & self , opts : & CdnOptions ) -> Option < String >
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:
Field Type Description sizeOption<u32>Image size in pixels (power of two). extensionOption<String>File format ("png", "webp", "jpg"). Defaults to "png".
Edit and delete
edit
pub async fn edit ( & self , rest : & Rest , body : & Value ) -> crate :: Result < ApiGuild >
Updates guild settings. Pass only the fields you want to change.
delete
pub async fn delete ( & self , rest : & Rest ) -> crate :: Result <()>
Deletes the guild. Owner only.
transfer_ownership
pub async fn transfer_ownership ( & self , rest : & Rest , new_owner_id : & str ) -> crate :: Result < ApiGuild >
Transfers guild ownership to another user.
Channels
create_channel
pub async fn create_channel ( & self , rest : & Rest , body : & Value ) -> crate :: Result < ApiChannel >
Creates a channel in the guild.
fetch_channels
pub async fn fetch_channels ( & self , rest : & Rest ) -> crate :: Result < Vec < ApiChannel >>
Returns the list of all channels in the guild.
set_channel_positions
pub async fn set_channel_positions ( & self , rest : & Rest , positions : & Value ) -> crate :: Result <()>
Sets channel ordering.
Example: create a text channel
let body = serde_json :: json! ({
"name" : "general" ,
"type" : 0
});
let channel = guild . create_channel ( & rest , & body ) . await ? ;
println! ( "Created channel: {}" , channel . id);
Members
fetch_member
pub async fn fetch_member ( & self , rest : & Rest , user_id : & str ) -> crate :: Result < ApiGuildMember >
Returns a guild member by user ID.
fetch_members
pub async fn fetch_members (
& self ,
rest : & Rest ,
limit : Option < u32 >,
after : Option < & str >,
) -> crate :: Result < Vec < ApiGuildMember >>
Returns a list of members. limit - max entries, after - pagination by ID.
kick
pub async fn kick ( & self , rest : & Rest , user_id : & str ) -> crate :: Result <()>
Kicks a member from the guild.
Bans
ban
pub async fn ban ( & self , rest : & Rest , user_id : & str , reason : Option < & str >) -> crate :: Result <()>
Bans a user.
unban
pub async fn unban ( & self , rest : & Rest , user_id : & str ) -> crate :: Result <()>
Lifts a ban.
fetch_bans
pub async fn fetch_bans ( & self , rest : & Rest ) -> crate :: Result < Vec < ApiBan >>
Returns the list of active bans in the guild.
Example: ban and list bans
guild . ban ( & rest , "USER_ID" , Some ( "Rule violation" )) . await ? ;
let bans = guild . fetch_bans ( & rest ) . await ? ;
for ban in & bans {
println! ( "Banned: {} - {}" , ban . user . username, ban . reason . as_deref () . unwrap_or ( "-" ));
}
Roles
fetch_roles
pub async fn fetch_roles ( & mut self , rest : & Rest ) -> crate :: Result < Vec < Role >>
Fetches guild roles and updates the guild.roles field.
create_role
pub async fn create_role ( & mut self , rest : & Rest , body : & CreateRoleBody ) -> crate :: Result < Role >
Creates a new role.
add_role_to_member / remove_role_from_member
pub async fn add_role_to_member ( & self , rest : & Rest , user_id : & str , role_id : & str ) -> crate :: Result <()>
pub async fn remove_role_from_member ( & self , rest : & Rest , user_id : & str , role_id : & str ) -> crate :: Result <()>
Assigns or removes a role from a member.
set_role_positions
pub async fn set_role_positions ( & self , rest : & Rest , positions : & Value ) -> crate :: Result < Vec < ApiRole >>
Sets the role order.
resolve_role_id
pub fn resolve_role_id ( & self , role : & str ) -> Option < String >
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.
Example: create a role and assign it to a member
use fluxer_types :: role :: CreateRoleBody ;
let body = CreateRoleBody {
name : Some ( "Moderator" . to_string ()),
color : Some ( 0x3498DB ),
hoist : Some ( true ),
mentionable : Some ( false ),
permissions : None ,
};
let role = guild . create_role ( & rest , & body ) . await ? ;
guild . add_role_to_member ( & rest , "USER_ID" , & role . id) . await ? ;
Emoji
fetch_emojis / fetch_emoji
pub async fn fetch_emojis ( & self , rest : & Rest ) -> crate :: Result < Vec < ApiEmoji >>
pub async fn fetch_emoji ( & self , rest : & Rest , emoji_id : & str ) -> crate :: Result < ApiEmoji >
Returns all guild emoji or a specific one.
create_emoji
pub async fn create_emoji (
& self ,
rest : & Rest ,
name : & str ,
image : & str ,
role_ids : Option < & [ String ]>,
) -> crate :: Result < ApiEmoji >
Creates a custom emoji. image is a data URI in the format data:image/png;base64,....
bulk_create_emojis
pub async fn bulk_create_emojis (
& self ,
rest : & Rest ,
emojis : & [( & str , & str )],
) -> Vec < ApiEmoji >
Creates multiple emoji in a single call. Errors for individual emoji are ignored - only successfully created ones are returned.
Stickers
fetch_stickers / create_sticker
pub async fn fetch_stickers ( & self , rest : & Rest ) -> crate :: Result < Vec < ApiSticker >>
pub async fn create_sticker ( & self , rest : & Rest , body : & Value ) -> crate :: Result < ApiSticker >
Invites and webhooks
fetch_invites
pub async fn fetch_invites ( & self , rest : & Rest ) -> crate :: Result < Vec < ApiInvite >>
fetch_webhooks
pub async fn fetch_webhooks ( & self , rest : & Rest ) -> crate :: Result < Vec < ApiWebhook >>
fetch_vanity_url
pub async fn fetch_vanity_url ( & self , rest : & Rest ) -> crate :: Result < Value >
Returns the guild’s custom invite URL.
Audit log
fetch_audit_logs
pub async fn fetch_audit_logs ( & self , rest : & Rest ) -> crate :: Result < ApiGuildAuditLog >
Returns audit log entries.
Fluxer-specific settings
pub async fn set_text_channel_flexible_names ( & self , rest : & Rest , enabled : bool ) -> crate :: Result <()>
pub async fn set_detached_banner ( & self , rest : & Rest , enabled : bool ) -> crate :: Result <()>
pub async fn set_disallow_unclaimed_accounts ( & self , rest : & Rest , enabled : bool ) -> crate :: Result <()>
Guild settings specific to Fluxer with no Discord API equivalent.
Method Description set_text_channel_flexible_namesEnables or disables flexible text channel names. set_detached_bannerControls the guild’s detached banner. set_disallow_unclaimed_accountsPrevents unactivated accounts from joining the guild.