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.
- async get_guild(id, with_counts)#
Gets a guild from the Guild ID
- Parameters:
id – The id of the guild you want
with_counts – an optional parameter that indicates you want (True) Discord to return
approximate_member_countapproximate_presence_countor not (False). Defaults to False
- Type:
bool or None
- Type:
int or None
- Returns:
The guild object for the given id
- Return type:
New in version 1.2: Based off of the
GET /guilds/<id>endpoint
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 or None
- property avatar#
The user’s avatar hash
- Type:
str or 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 or None
- property accent_color#
The user’s banner color, as a hexadecimal
- Type:
int or 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 or None
- property flags#
The flags on the user’s account
- Type:
int or None
The type of nitro the user has
- Type:
int or None
- property public_flags#
The public flags on a user’s account
- Type:
int or None
- property avatar_decoration#
The user’s avatar decoration hash
- Type:
str or None
- class GuildObj#
New in version 1.2: Represents a guild object returned by Discord
- property id#
The id of the Guild
- property name#
The name of the guild
- Type:
str
- property icon#
The icon hash of the guild
- Type:
str or None
- property icon_url#
The url for the guild’s icon
- Type:
str or None
- property splash#
The splash hash of the guild
- Type:
str or None
- property discovery_splash#
The discovery splash hash of the guild
- Type:
str or None
- property owner#
Whether the user is the owner of the guild. Returned only when using the
get_user_guilds()method- Type:
bool or None
- property owner_id#
the user id of the owner of the guild
- property permissions#
The permissions of the user in the current guild
- Type:
str or None
- property perms#
The shortened name of permissions
See also
- Property
permissions The regular name
- Type:
str or None
- Property
- property region#
the region of the guild
- Type:
str or None
- property afk_channel_id#
the channel id where afk users go
- property afk_timeout#
The time it takes for a afk user to be sent to the afk channel
- property widget_enabled#
Whether a widget is enabled or not
- Type:
bool or None
- property widget_channel_id#
The channel the widget is in
- property verification_level#
The level of verification in the guild
- Type:
int or None
- property default_message_notifications#
The default notification level of the guild
- Type:
int or None
- property explicit_content_filter#
The content filter level of the guild
- Type:
int or None
- property roles#
The roles of the guild, as an array
- property emojis#
The emojis of the guild, as an array of emoji object
- property features#
The features of the guild
- property mfa_level#
The required level of MFA (Multi-Factor Authentication) for the guild
- Type:
int
- property application_id#
ID of the application that made the guild, if it is bot-created
- property system_channel_id#
the id of the channel where guild notices such as welcome messages and boost events are posted
- property system_channel_flags#
System channel flags
- Type:
integer
- property rules_channel_id#
the id of the channel where Community guilds can display rules and/or guidelines
- property max_presences#
the maximum number of presences for the guild (None is always returned apart from the largest of guilds)
- Type:
int or None
- property max_members#
the maximum number of members for the guild
- Type:
int or None
- property vanity_url_code#
the vanity url code for the guild
- Type:
str or None
- property description#
the description of the guild
- Type:
str or None
- property banner#
The banner hash
- Type:
str or None
The guild’s premium tier (Server Boost level)
- Type:
int
the number of boosts this guild currently has
- Type:
int or None
- property preferred_locale#
The preferred locale of a community guild; userd in server discovery and notices from Discord, and sent in interactions; defaults to “en-US”
- Type:
str
- property public_updates_channel_id#
The id of the channel where admins and moderators of Community guilds recieve notices from Discord
- property max_video_channel_users#
The maximum amount of users in a video channel
- Type:
int
- property max_stage_video_channel_users#
the maximum amount of users in a stage video channel
- Type:
int
- property approximate_member_count#
approximate number of members in this guild, returned from
get_guild()and :meth`get_user_guilds` whenwith_countsisTrue- Type:
int
- property approximate_presence_count#
approximate number of non-offline members in this guild, returned from the
get_guild()andget_user_guilds()whenwith_countsisTrue- Type:
int
- property welcome_screen#
the welcome screen of a Community guild, shown to new members, returned in an Invite’s guild object
- Type:
Discord welcome screen object
- property nsfw_level#
The guild’s nsfw level
- Type:
int
- property stickers#
The guild’s custom stickers
whether the guild has the boost progress bar enabled
- Type:
bool
- property safety_alerts_channel_id#
the id of the channel where admins and moderators of Community guilds recieve safety alerts from Discord