discord-ext-oauth

User Objects

class discord.ext.oauth.user.User(*, http: HTTPClient, data: dict, acr: AccessTokenResponse)

A class representing a user object, containing information from the OAuth2 API.

id

The id of the user

Type

int

name

The username of the user

Type

str

avatar_url

The asset url for the user’s avatar

Type

str

discriminator

The user’s discriminator

Type

str

mfa_enabled

Whether the user has multi-factor authentication (2fa usually) enabled on their account

Type

bool

email

The user’s email. Can be None if the user has no email, or you do not have the email scope selected

Type

Optional[str]

verified

Whether the user has a verified account

Type

bool

access_token

The access token used to get this user object

Type

str

refresh_token

The refresh token to refresh the access token

Type

str

await fetch_guilds(*, refresh: bool = True) List[discord.ext.oauth.guild.Guild]

Makes an api call to fetch the guilds the user is in. Can fill a normal dictionary cache.

Parameters

refresh (bool, optional) – Whether or not to refresh the guild cache attached to this user object. If false, returns the cached guilds, defaults to True

Returns

A List of Guild objects either from cache or returned from the api call

Return type

List[Guild]

await refresh() AccessTokenResponse

Refreshes the access token for the user and returns a fresh access token response.

Returns

A class holding information about the new access token

Return type

AccessTokenResponse