Skip to main content

User

Representation of a Fluxer user. Stored in the client.users cache.

Fields


Constructors

User::from_api

Creates a User from an API response. flags is taken from flags or public_flags - whichever is non-empty first.

User::unknown

Returns a stub with username = "Unknown" and an empty id. Use when user data is unavailable.

Methods

display_name

Returns global_name if set, otherwise username.

mention

Returns the mention string in the format <@id>. The Display trait is implemented identically.

avatar_url

Returns the user’s 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

Same as avatar_url, but falls back to the default avatar URL (https://fluxerstatic.com/avatars/{index}.png) instead of returning None.
Returns the profile banner URL. None if banner is None.

create_dm

Opens a DM channel with the user. If the channel already exists, it is returned without creating a new one.

patch

Updates 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 the client.members[guild_id][user_id] cache.

Fields


Constructors

GuildMember::from_api

Creates a GuildMember from an API response and a guild ID.

Methods

display_name

Returns nick if set, otherwise user.display_name().

mention

Returns the member mention string in the format <@user_id>.

has_role

Returns true if the role ID is in roles.

timeout_active

Returns true if communication_disabled_until is set and the date has not yet passed.

ClientUser

The bot’s own account data. Available via client.user() after a successful login.

Fields


Access

client.user() returns None before login completes. Do not call it before the Ready event is received.

CdnOptions

Used in avatar_url, banner_url, icon_url, and similar methods.