API#
- class AuthUrl(client_id, scope, redirect_uri)#
the base of the authorization url
- Parameters:
client_id (str) – The client id of your app
scope (List[str]) – A list of Discord scopes
redirect_uri (str) – The redirect uri you want to use
- async makeUrl()#
Makes the actual url and returns it
- Returns:
The auth link
- Return type:
str
- class discordApi(client_id, client_secret, scope, redirect_uri)#
Where you can get your access token, and use some Discord API links
- Parameters:
client_id (str) – The client id of your app
client_secret (str) – The client secret of your app
scope (List[str]) – a list of the scopes you authorized for
redirect_uri (str) – The redirect_uri you want to use
- async accessToken(code)#
Makes a request to discord to get an access token
- Parameters:
code (str) – The code that you get after the user gets redirected to your application
- Returns:
The response recieved after the request is made
- Return type:
dict[str, str]
- class User(access_token)#
The links for the User API in Discord
- Parameters:
access_token – The access token you get after using the
accessToken()method in thediscordApiclass
- async get_current_user()#
Uses the access token provided to request the current user from discord api
- Returns:
The response from the Discord API
- Return type:
- async get_user_guilds()#
Gets the users guilds from Discord
- Returns:
A list of partial Guild objects
- Return type:
List[str]
New in version 1.1: Used to get the users guilds.
Models#
Important
None of the classes, functions, methods, or objects mentioned below are meant to be set by the user, only by the package
The models are what I use to return a object that is sent from Discord Api
- class UserObj(payload)#
- property id#
The user’s id
- property username#
The user’s username (not always unique)
- Type:
str
- property discriminator#
the user’s Discord-Tag
- Type:
str
- property global_name#
The display name. For bots, it’s the application name
- Type:
str | None
- property avatar#
The user’s avatar hash
- Type:
str | None
- property bot#
Whether the user is a bot or not
- Type:
bool
- property system#
Whether the user is a part of the Discord System or not
- Type:
bool
- property mfa_enabled#
Whether the user has Multi-Factor Authentication on or not
- Type:
bool
- property banner#
The user’s banner hash.
- Type:
str | None
- property accent_color#
The user’s banner color, as a hexadecimal
- Type:
int | None
- property locale#
The user’s selected language option
- Type:
str
- property verified#
Whether the user’s email is verified or not
- Type:
bool
- property email#
The user’s email
- Type:
str | None
- property flags#
The flags on the user’s account
- Type:
int | None
The type of nitro the user has
- Type:
int | None
- property public_flags#
The public flags on a user’s account
- Type:
int | None
- property avatar_decoration#
The user’s avatar decoration hash
- Type:
str | None