API#

Note

This is the deprecated documentation, to visit the up to date documentation, check the reference page

class AuthUrl(client_id, scope, redirect_uri, permissions)#

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

  • permissions (int or the permissions class) – The permissions of the bot, Optional

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 the discordApi class

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:

UserObj

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_count approximate_presence_count or not (False). Defaults to False

Type:

bool or None

Type:

int or None

Returns:

The guild object for the given id

Return type:

GuildObj

New in version 1.2: Based off of the GET /guilds/<id> endpoint

class bot(client_id, permissions)#

Makes an auth url, but for bots

Parameters:
  • client_id – The client id of your bot

  • permissions (int or permissions) – The permissions of your bot

async url()#

Returns the url for the bot auth

Returns:

The url for bot auth

Return type:

str

class permissions(permissions)#

Updates, removes, and adds permissions that you want to use

New in version 1.3.

Parameters:

permissions (List of int or str, int, str, dictionary with keys as either int or str and values as bools, or None) – The permissions you want to use. Optional

async update(permissions)#

Updates the permissions to what you want

Parameters:

permissions (List of int or str, str, int, Dictionary of int or str as keys and a bool as the value) – The permissions you want to update

async add(permissions)#

Adds the permissions provided to the value, and if the permissions is already added, doesn’t change it.

Parameters:

permissions (int, str, or list of int or str) – The permissions you want to add

async remove(permissions)#

Removes the permissions provided, and if the permissions were already False, it doesn’t change it.

Parameters:

permissions (int, str, or list of int or str) – The permissions you want to remove

async all()#

Adds all of the permissions to the permission value

async none()#

Sets all permissions to false

async general()#

sets the permission value to include the following permissions:

  • manage_guild

  • manage_roles

  • manage_channels

  • manage_guild_expressions

  • manage_webhooks

  • view_audit_log

  • view_channel

  • view_guild_insights

async allChannel()#

sets the permission value to include the following permissions:

  • manage_roles

  • manage_channels

  • create_instant_invite

  • manage_webhooks

  • view_channel

  • send_messages

  • use_external_sticker

  • create_public_threads

  • create_private_threads

  • send_tts_messages

  • send_messages

  • manage_threads

  • embed_links

  • attach_files

  • read_message_history

  • mention_everyone

  • add_reactions

  • use_external_emojis

  • moderate_members

  • use_application_commands

  • connect

  • speak

  • mute_members

  • deafen_members

  • move_members

  • use_vad

  • priority_speaker

  • request_to_speak

  • stream

  • use_soundboard

async membership()#

sets the permission value to include the following permissions:

  • kick_members

  • ban_members

  • create_instant_invite

  • manage_nicknames

  • change_nickname

  • moderate_members

async text()#

sets the permission value to include the following permissions:

  • send_messages

  • use_external_sticker

  • create_public_threads

  • create_private_threads

  • send_tts_messages

  • manage_messages

  • embed_links

  • attach_files

  • read_message_history

  • mention_everyone

  • add_reactions

  • use_external_emojis

  • moderate_members

  • use_application_commands

  • send_voice_messages

async voice()#

sets the permission value to include the following permissions:

  • connect

  • speak

  • mute_members

  • deafen_members

  • use_vad

  • priority_speaker

  • stream

  • use_embedded_activities

  • use_soundboard

  • use_external_sounds

async stage()#

sets the permission value to include the following permissions:

  • request_to_speak

async stage_moderator()#

sets the permission value to include the following permissions:

  • manage_channels

  • mute_members

  • move_members

async elevated()#

sets the permission value to include the following permissions:

  • administrator

  • manage_guild

  • manage_roles

  • manage_channels

  • kick_members

  • ban_members

  • manage_guild_expressions

  • manage_guild

  • moderate_members

  • manage_messages

  • manage_threads

async advanced()#

sets the permission value to include the following permissions:

  • administrator

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

property premium_type#

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 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

property premium_tier#

The guild’s premium tier (Server Boost level)

Type:

int

property premium_subscription_count#

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` when with_counts is True

Type:

int

property approximate_presence_count#

approximate number of non-offline members in this guild, returned from the get_guild() and get_user_guilds() when with_counts is True

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

property premium_progress_bar_enabled#

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