User
Representation of a Fluxer user. Stored in theclient.users cache.
Fields
| Field | Type | Description |
|---|---|---|
id | Snowflake | Unique user identifier. |
username | String | Username. |
discriminator | String | Discriminator (e.g. "0" if unused). |
global_name | Option<String> | Display name. Takes precedence over username when set. |
avatar | Option<String> | Avatar hash. None if using the default avatar. |
bot | bool | true if the account is a bot. |
avatar_color | Option<u32> | Default avatar color (RGB integer). |
flags | Option<u32> | Account bitfield flags (public). |
system | bool | true for Fluxer system accounts. |
banner | Option<String> | Profile banner hash. |
Constructors
User::from_api
User from an API response. flags is taken from flags or public_flags - whichever is non-empty first.
User::unknown
username = "Unknown" and an empty id. Use when user data is unavailable.
Methods
display_name
global_name if set, otherwise username.
mention
<@id>. The Display trait is implemented identically.
avatar_url
None if avatar is None.
URL format: https://fluxerusercontent.com/avatars/{user_id}/{hash}.{ext}.
For animated avatars (hash starts with a_) the extension is automatically set to gif.
display_avatar_url
avatar_url, but falls back to the default avatar URL (https://fluxerstatic.com/avatars/{index}.png) instead of returning None.
banner_url
None if banner is None.
create_dm
Example: open a DM and send a message
Example: open a DM and send a message
patch
User fields with data from the API. Called automatically by the client on USER_UPDATE and when a cached user is encountered again.
GuildMember
Representation of a guild member. Stored in theclient.members[guild_id][user_id] cache.
Fields
| Field | Type | Description |
|---|---|---|
user | User | User data. |
guild_id | Snowflake | ID of the guild this member belongs to. |
nick | Option<String> | Member’s guild nickname. None if not set. |
roles | Vec<Snowflake> | List of role IDs the member has. |
joined_at | Option<String> | Date the member joined the guild (ISO 8601). |
premium_since | Option<String> | Date the member started boosting the guild. None if not boosting. |
deaf | bool | Whether the member is server-deafened in a voice channel. |
mute | bool | Whether the member is server-muted in a voice channel. |
pending | Option<bool> | Whether the member has passed the membership screening. |
communication_disabled_until | Option<String> | Timeout expiry date. None if no active timeout. |
Constructors
GuildMember::from_api
GuildMember from an API response and a guild ID.
Methods
display_name
nick if set, otherwise user.display_name().
mention
<@user_id>.
has_role
true if the role ID is in roles.
timeout_active
true if communication_disabled_until is set and the date has not yet passed.
Example: check a member's role and display their nick
Example: check a member's role and display their nick
Example: fetch a member via REST
Example: fetch a member via REST
ClientUser
The bot’s own account data. Available viaclient.user() after a successful login.
Fields
| Field | Type | Description |
|---|---|---|
id | Snowflake | Bot account ID. |
username | String | Bot username. |
discriminator | String | Discriminator. |
global_name | Option<String> | Display name. |
avatar | Option<String> | Avatar hash. |
bot | bool | Always true for a bot. |
flags | Option<u32> | Account flags. |
verified | Option<bool> | Whether the account is verified. |
email | Option<String> | Email (only available via OAuth2). |
Access
CdnOptions
Used inavatar_url, banner_url, icon_url, and similar methods.
| Field | Type | Description |
|---|---|---|
size | Option<u32> | Image size in pixels. Must be a power of two (16–4096). |
extension | Option<String> | File format: "png", "webp", "jpg". Defaults to "png". For animated hashes (a_*) always uses "gif". |
Example: get a 256px avatar in webp format
Example: get a 256px avatar in webp format
