Users#

Manager#

class UserManager(state: ConnectionState, cache: CacheStorage)#

Bases: BaseManager

Manager used to fetch User objects.

async fetch_me() User#

Fetches the user object of the bot. This should generally not be called as it is accessible on startup via Bot.user.

Raises:

HTTPException – A HTTP error occured.

get(user_id: int) User | None#

Attempts to fetch a User from the internal cache of the bot.

Parameters:

user_id (int) – The user_id of the user to fetch.

Returns:

  • User – The User received from the cache.

  • None – Could not find the User object in the internal cache.

async fetch(user_id: int) User#

Attempts to fetch a User from the Discord API.

Parameters:

user_id (int) – The user_id of the user to fetch.

Returns:

The User object recieved from Discord API.

Return type:

User

Raises:
async get_or_fetch(user_id: int) User#

A couroutine function that attempts to fetch a User from internal cache and if not present, makes an API call to discord.

Parameters:

user_id (int) – The user_id of the user to fetch.

Returns:

The User object recieved from Discord API or cache.

Return type:

User

Raises:

Users#

class PartialUser(data: PartialUserPayload, *, state: ConnectionState)#

Bases: object

id#
property created_at: datetime#
class User(data: UserPayload, *, state: ConnectionState)#

Bases: PartialUser

name#
discriminator#
global_name#
avatar#
bot#
system#
mfa_enabled#
banner#
accent_color#
locale#
verified#
email#
flags#
avatar_decoration#
nameplate#
primary_guild#
property premium: PremiumType | None#

Returns PremiumType.NONE if the user has no Nitro or you are missing identify.premium scope.

member#
property created_at: datetime#
id#

Presences#

class Activity(data: ActivityPayload)#

Bases: object

name#
type#
url#
created_at#
timestamps#
application_id#
status_display_type#
details#
details_url#
state#
state_url#
emoji#
party#
assets#
secrets#
instance#
flags#
buttons#
class Presence(data: PresencePayload, *, state: ConnectionState)#

Bases: object

user#
guild_id#
status#
activities#

Primary Guild#

class UserPrimaryGuild(data: UserPrimaryGuildPayload)#

Bases: object

id#
enabled#
tag#
badge#
property created_at: datetime | None#

Decorations#

class AvatarDecoration(data: AvatarDecorationPayload)#

Bases: object

Represents a User’s Avatar Decoration.

sku_id: Snowflake#

The Sku ID of this AvatarDecoration.

asset: Asset#

The Asset of the AvatarDecoration.

class Nameplate(data: NameplatePayload)#

Bases: object

sku_id#
asset#
label#
palette#
property created_at: datetime#

Members#

class PartialMember(data: PartialMemberPayload, *, guild_id: int, user_id: int, state: ConnectionState)#

Bases: object

guild_id#
id#
nick#
asset#
banner#
roles#
joined_at#
premium_since#
flags#
pending#
permissions#
communication_disabled_until#
avatar_decoration_data#
nameplate#
property is_timed_out: bool#
property created_at: datetime#
class Member(data: MemberPayload, *, guild_id: int, user_id: None = None, state: ConnectionState)#
class Member(data: MemberPayload, *, guild_id: int, user_id: int, state: ConnectionState)

Bases: PartialMember

user#
deaf#
asset#
avatar_decoration_data#
banner#
communication_disabled_until#
property created_at: datetime#
flags#
guild_id#
id#
property is_timed_out: bool#
joined_at#
nameplate#
nick#
pending#
permissions#
premium_since#
roles#
mute#

User Enums#

class PremiumType(*values)#
NONE = 0#
CLASSIC = 1#
NITRO = 2#
BASIC = 3#

Presence Enums#

class ActivityType(*values)#
Playing = 0#
Streaming = 1#
Listening = 2#
Watching = 3#
Custom = 4#
Competing = 5#
class StatusDisplayType(*values)#
Name = 0#
State = 1#
Details = 2#
class PresenceStatusType(*values)#
idle = 'idle'#
dnd = 'dnd'#
online = 'online'#
offline = 'offline'#