hikari.applications#
Application and entities related to discord’s OAuth2 flow.
Module Contents#
- class hikari.applications.Application[source]#
Bases:
hikari.guilds.PartialApplication
Represents the information of an Oauth2 Application.
- property cover_image_url: hikari.files.URL | None[source]#
Rich presence cover image URL for this application, if set.
- app: hikari.traits.RESTAware[source]#
Client application that models may use for procedures.
- cover_image_hash: str | None[source]#
The CDN’s hash of this application’s default rich presence invite cover image.
- flags: ApplicationFlags[source]#
The flags for this application.
- install_parameters: ApplicationInstallParameters | None[source]#
Settings for the application’s default in-app authorization link, if enabled.
- is_bot_code_grant_required: bool[source]#
True
if this application’s bot is requiring code grant for invites.
- owner: hikari.users.User[source]#
The application’s owner.
- role_connections_verification_url: str | None[source]#
The URL of this application’s role connection verification entry point.
- rpc_origins: Sequence[str] | None[source]#
A collection of this application’s RPC origin URLs, if RPC is enabled.
- tags: Sequence[str][source]#
A sequence of tags describing the content and functionality of the application.
- team: Team | None[source]#
The team this application belongs to.
If the application is not part of a team, this will be
None
.
- make_cover_image_url(*, ext='png', size=4096)[source]#
Generate the rich presence cover image URL for this application, if set.
- Parameters:
- Returns:
typing.Optional
[hikari.files.URL
]The URL, or
None
if no cover image exists.
- Raises:
ValueError
If the size is not an integer power of 2 between 16 and 4096 (inclusive).
- class hikari.applications.ApplicationFlags[source]#
Bases:
hikari.internal.enums.Flag
The known application flag bits.
- APPLICATION_COMMAND_BADGE[source]#
Denotes that the application has at least one global application command.
- EMBEDDED[source]#
Denotes that the application has functionality that’s specially embedded in Discord’s client.
- GUILD_MEMBERS_INTENT[source]#
Denotes that the application has the GUILD_MEMBERS intent enabled in it’s dashboard.
- GUILD_PRESENCES_INTENT[source]#
Denotes that the application has the GUILD_PRESENCES intent enabled in it’s dashboard.
- MESSAGE_CONTENT_INTENT[source]#
Denotes that the application has message content intent enabled in it’s dashboard.
- MESSAGE_CONTENT_INTENT_LIMITED[source]#
Denotes that the application has message content access while pending verification.
- class hikari.applications.ApplicationRoleConnectionMetadataRecord[source]#
Represents a role connection metadata record.
- description_localizations: Mapping[hikari.locales.Locale | str, str][source]#
A mapping of description localizations for this metadata field.
- name_localizations: Mapping[hikari.locales.Locale | str, str][source]#
A mapping of name localizations for this metadata field.
- type: ApplicationRoleConnectionMetadataRecordType | int[source]#
The type of metadata value record.
- class hikari.applications.ApplicationRoleConnectionMetadataRecordType[source]#
Bases:
int
,hikari.internal.enums.Enum
Represents possible application role connection metadata record types.
- class hikari.applications.AuthorizationApplication[source]#
Bases:
hikari.guilds.PartialApplication
The application model found attached to
AuthorizationInformation
.- is_bot_code_grant_required: bool | None[source]#
True
if this application’s bot is requiring code grant for invites.Will be
None
if this application doesn’t have a bot.
- class hikari.applications.AuthorizationInformation[source]#
Model for the data returned by Get Current Authorization Information.
- application: AuthorizationApplication[source]#
The current application.
- expires_at: datetime.datetime[source]#
When the access token this data was retrieved with expires.
- scopes: Sequence[OAuth2Scope | str][source]#
A sequence of the scopes the current user has authorized the application for.
- user: hikari.users.User | None[source]#
The user who has authorized this token if they included the
identify
scope.
- class hikari.applications.ConnectionVisibility[source]#
Bases:
int
,hikari.internal.enums.Enum
Describes who can see a connection with a third party account.
- class hikari.applications.InviteApplication[source]#
Bases:
hikari.guilds.PartialApplication
Represents the information of an Invite Application.
- property cover_image_url: hikari.files.URL | None[source]#
Rich presence cover image URL for this application, if set.
- app: hikari.traits.RESTAware[source]#
Client application that models may use for procedures.
- cover_image_hash: str | None[source]#
The CDN’s hash of this application’s default rich presence invite cover image.
- make_cover_image_url(*, ext='png', size=4096)[source]#
Generate the rich presence cover image URL for this application, if set.
- Parameters:
- Returns:
typing.Optional
[hikari.files.URL
]The URL, or
None
if no cover image exists.
- Raises:
ValueError
If the size is not an integer power of 2 between 16 and 4096 (inclusive).
- class hikari.applications.OAuth2AuthorizationToken[source]#
Bases:
PartialOAuth2Token
Model for the OAuth2 token data returned by the authorization grant flow.
- guild: hikari.guilds.RESTGuild | None[source]#
Object of the guild the user was added to.
This will only be present if this token was authorized with the
bot
scope, otherwise this will beNone
.
- webhook: hikari.webhooks.IncomingWebhook | None[source]#
Object of the webhook that was created.
This will only be present if this token was authorized with the
webhooks.incoming
scope, otherwise this will beNone
.
- class hikari.applications.OAuth2ImplicitToken[source]#
Bases:
PartialOAuth2Token
Model for the OAuth2 token data returned by the implicit grant flow.
- class hikari.applications.OAuth2Scope[source]#
Bases:
str
,hikari.internal.enums.Enum
OAuth2 Scopes that Discord allows.
These are categories of permissions for applications using the OAuth2 API directly. Most users will only ever need the
BOT
scope when developing bots.- ACTIVITIES_READ = 'activities.read'[source]#
Enables fetching the “Now Playing/Recently Played” list.
Note
You must be whitelisted to use this scope.
- ACTIVITIES_WRITE = 'activities.write'[source]#
Enables updating a user’s activity.
Note
You must be whitelisted to use this scope.
Note
This is not required to use the GameSDK activity manager.
- APPLICATIONS_BUILDS_READ = 'applications.builds.read'[source]#
Enables reading build data for a user’s applications.
Note
You must be whitelisted to use this scope.
- APPLICATIONS_BUILDS_UPLOAD = 'applications.builds.upload'[source]#
Enables uploading/updating builds for a user’s applications.
Note
You must be whitelisted to use this scope.
- APPLICATIONS_COMMANDS = 'applications.commands'[source]#
Allows your application’s commands to be used in a guild.
This is used in Discord’s special Bot Authorization Flow like
OAuth2Scope.BOT
in-order to join an application into a guild as an application command providing integration.
- APPLICATIONS_COMMANDS_PERMISSION_UPDATE = 'applications.commands.permissions.update'[source]#
Allows your application to update its commands permissions via a bearer token.
- APPLICATIONS_COMMANDS_UPDATE = 'applications.commands.update'[source]#
Allows your application to update its commands via a bearer token.
- APPLICATIONS_ENTITLEMENTS = 'applications.entitlements'[source]#
Enables reading entitlements for a user’s applications.
- APPLICATIONS_STORE_UPDATE = 'applications.store.update'[source]#
Enables reading/updating store data for the user’s applications.
This includes store listings, achievements, SKU’s, etc.
Note
The store API is deprecated and may be removed in the future.
- BOT = 'bot'[source]#
Enables adding a bot application to a guild.
Note
This requires you to have set up a bot account for your application.
- GROUP_DM_JOIN = 'gdm.join'[source]#
Enables joining users into a group DM.
Warning
This cannot add the bot to a group DM.
- GUILDS_JOIN = 'guilds.join'[source]#
Enables adding the user to a specific guild.
Note
This requires you to have set up a bot account for your application.
- IDENTIFY = 'identify'[source]#
Enables viewing info about itself.
Note
This does not include email address info. Use the
EMAIL
scope instead to retrieve this information.
- RELATIONSHIPS_READ = 'relationships.read'[source]#
Enables viewing a user’s friend list.
Note
You must be whitelisted to use this scope.
- ROLE_CONNECTIONS_WRITE = 'role_connections.write'[source]#
Used to write to the current user’s connection and metadata for the app.
- RPC = 'rpc'[source]#
Enables the RPC application to control the local user’s Discord client.
Note
You must be whitelisted to use this scope.
- RPC_MESSAGES_READ = 'messages.read'[source]#
Enables the RPC application to read messages from all channels the user is in.
- class hikari.applications.OwnApplicationRoleConnection[source]#
Represents an own application role connection.
- metadata: Mapping[str, str][source]#
Mapping application role connection metadata keys to their value.
Note
Unfortunately, these can’t be deserialized to their proper types as Discord don’t provide a way to difference between them.
- You can deserialize them yourself based on what value you expect from the key:
INTEGER_X
: Cast to anint
.DATETIME_X
: Cast to adatetime.datetime.fromisoformat
orciso8601.parse_rfc3339
for speed.BOOLEAN_X
: Cast to abool
.
- class hikari.applications.OwnConnection[source]#
Represents a user’s connection with a third party account.
Returned by the
GET Current User Connections
endpoint.- id: str[source]#
The string ID of the third party connected account.
Warning
Seeing as this is a third party ID, it will not be a snowflakes.
- integrations: Sequence[hikari.guilds.PartialIntegration][source]#
A sequence of the partial guild integration objects this connection has.
- is_activity_visible: bool[source]#
True
if this connection’s activities are shown in the user’s presence.
- visibility: ConnectionVisibility | int[source]#
The visibility of the connection.
- class hikari.applications.OwnGuild[source]#
Bases:
hikari.guilds.PartialGuild
Represents a user bound partial guild object.
- features: Sequence[str | hikari.guilds.GuildFeature][source]#
A list of the features in this guild.
- my_permissions: hikari.permissions.Permissions[source]#
The guild-level permissions that apply to the current user or bot.
- class hikari.applications.PartialOAuth2Token[source]#
Model for partial OAuth2 token data returned by the API.
This will generally only be returned when by the client credentials OAuth2 flow.
- expires_in: datetime.timedelta[source]#
Lifetime of this access token.
- scopes: Sequence[OAuth2Scope | str][source]#
Scopes the access token has access to.
- class hikari.applications.Team[source]#
Bases:
hikari.snowflakes.Unique
Represents a development team, along with all its members.
- property icon_url: hikari.files.URL | None[source]#
Icon URL, or
None
if no icon exists.
- app: hikari.traits.RESTAware[source]#
Client application that models may use for procedures.
- icon_hash: str | None[source]#
The CDN hash of this team’s icon.
If no icon is provided, this will be
None
.
- id: hikari.snowflakes.Snowflake[source]#
The ID of this entity.
- members: Mapping[hikari.snowflakes.Snowflake, TeamMember][source]#
A mapping containing each member in this team.
The mapping maps keys containing the member’s ID to values containing the member object.
- owner_id: hikari.snowflakes.Snowflake[source]#
The ID of this team’s owner.
- make_icon_url(*, ext='png', size=4096)[source]#
Generate the icon URL for this team if set.
- Parameters:
- Returns:
typing.Optional
[hikari.files.URL
]The URL, or
None
if no icon exists.
- Raises:
ValueError
If the size is not an integer power of 2 between 16 and 4096 (inclusive).
- class hikari.applications.TeamMember[source]#
Bases:
hikari.users.User
Represents a member of a Team.
- property app: hikari.traits.RESTAware[source]#
Return the app that is bound to the user object.
- membership_state: TeamMembershipState | int[source]#
The state of this user’s membership.
- permissions: Sequence[str][source]#
This member’s permissions within a team.
At the time of writing, this will always be a sequence of one
str
, which will always be"*"
. This may change in the future, however.
- team_id: hikari.snowflakes.Snowflake[source]#
The ID of the team this member belongs to.
- user: hikari.users.User[source]#
The user representation of this team member.
- class hikari.applications.TeamMembershipState[source]#
Bases:
int
,hikari.internal.enums.Enum
Represents the state of a user’s team membership.
- class hikari.applications.TokenType[source]#
Bases:
str
,hikari.internal.enums.Enum
Token types used within Hikari clients.
- hikari.applications.get_token_id(token)[source]#
Try to get the bot ID stored in a token.
- Returns:
hikari.snowflakes.Snowflake
The ID that was extracted from the token.
- Raises:
ValueError
If the passed token has an unexpected format.