Skip to content

hikari.applications#

Application and entities related to discord's OAuth2 flow.

ActivityInstance #

Represents a live application activity instance.

application_id class-attribute instance-attribute #

application_id: Snowflake = attrs.field(
    eq=False, hash=False, repr=True
)

The ID of the application this activity instance belongs to.

instance_id class-attribute instance-attribute #

instance_id: str = attrs.field(hash=True, repr=True)

The unique identifier for the activity instance.

launch_id class-attribute instance-attribute #

launch_id: Snowflake = attrs.field(
    eq=False, hash=False, repr=True
)

The unique identifier for the launch.

location class-attribute instance-attribute #

location: ActivityLocation = attrs.field(
    eq=False, hash=False, repr=True
)

The location this activity instance is running in.

users class-attribute instance-attribute #

users: Sequence[Snowflake] = attrs.field(
    eq=False, hash=False, repr=False
)

The IDs of the users currently connected to this activity instance.

ActivityLocation #

The location an activity instance is running in.

channel_id class-attribute instance-attribute #

channel_id: Snowflake = attrs.field(
    eq=False, hash=False, repr=True
)

The ID of the channel the activity instance is running in.

guild_id class-attribute instance-attribute #

guild_id: Snowflake | None = attrs.field(
    eq=False, hash=False, repr=True
)

The ID of the guild the activity instance is running in, if any.

id class-attribute instance-attribute #

id: str = attrs.field(hash=True, repr=True)

The unique identifier for the location.

kind class-attribute instance-attribute #

kind: ActivityLocationKind | str = attrs.field(
    eq=False, hash=False, repr=True
)

The kind of location the activity instance is running in.

ActivityLocationKind #

Bases: str, Enum

The kind of location an activity instance is running in.

GUILD_CHANNEL class-attribute instance-attribute #

GUILD_CHANNEL = 'gc'

The activity is running in a guild channel.

PRIVATE_CHANNEL class-attribute instance-attribute #

PRIVATE_CHANNEL = 'pc'

The activity is running in a private channel, such as a DM or group DM.

Application #

Bases: PartialApplication

Represents the information of an Oauth2 Application.

app class-attribute instance-attribute #

app: RESTAware = attrs.field(
    repr=False,
    eq=False,
    hash=False,
    metadata={attrs_extensions.SKIP_DEEP_COPY: True},
)

Client application that models may use for procedures.

approximate_guild_count class-attribute instance-attribute #

approximate_guild_count: int = attrs.field(
    eq=False, hash=False, repr=False
)

The approximate number of guilds this application is part of.

approximate_user_install_count class-attribute instance-attribute #

approximate_user_install_count: int = attrs.field(
    eq=False, hash=False, repr=False
)

The approximate number of users that have installed this application.

cover_image_hash class-attribute instance-attribute #

cover_image_hash: str | None = attrs.field(
    eq=False, hash=False, repr=False
)

The CDN's hash of this application's default rich presence invite cover image.

custom_install_url class-attribute instance-attribute #

custom_install_url: str | None = attrs.field(
    eq=False, hash=False, repr=False
)

The URL of this application's custom authorization link.

event_webhooks_status class-attribute instance-attribute #

event_webhooks_status: (
    ApplicationEventWebhookStatus | int
) = attrs.field(eq=False, hash=False, repr=False)

The status of this application's event webhooks.

event_webhooks_types class-attribute instance-attribute #

event_webhooks_types: Sequence[
    ApplicationEventWebhookType | str
] = attrs.field(eq=False, hash=False, repr=False)

The webhook event types this application subscribes to.

event_webhooks_url class-attribute instance-attribute #

event_webhooks_url: str | None = attrs.field(
    eq=False, hash=False, repr=False
)

The URL this application receives webhook events on, if set.

flags class-attribute instance-attribute #

flags: ApplicationFlags = attrs.field(
    eq=False, hash=False, repr=False
)

The flags for this application.

install_parameters class-attribute instance-attribute #

install_parameters: ApplicationInstallParameters | None = (
    attrs.field(eq=False, hash=False, repr=False)
)

Settings for the application's default in-app authorization link, if enabled.

integration_types_config class-attribute instance-attribute #

integration_types_config: Mapping[
    ApplicationIntegrationType,
    ApplicationIntegrationConfiguration,
] = attrs.field(eq=False, hash=False, repr=False)

The default scopes and permissions for each integration type.

is_bot_code_grant_required class-attribute instance-attribute #

is_bot_code_grant_required: bool = attrs.field(
    eq=False, hash=False, repr=False
)

True if this application's bot is requiring code grant for invites.

is_bot_public class-attribute instance-attribute #

is_bot_public: bool = attrs.field(
    eq=False, hash=False, repr=True
)

True if the bot associated with this application is public.

owner class-attribute instance-attribute #

owner: User = attrs.field(eq=False, hash=False, repr=True)

The application's owner.

privacy_policy_url class-attribute instance-attribute #

privacy_policy_url: str | None = attrs.field(
    eq=False, hash=False, repr=False
)

The URL of this application's privacy policy.

public_key class-attribute instance-attribute #

public_key: bytes = attrs.field(
    eq=False, hash=False, repr=False
)

The key used for verifying interaction and GameSDK payload signatures.

role_connections_verification_url class-attribute instance-attribute #

role_connections_verification_url: str | None = attrs.field(
    eq=False, hash=False, repr=False
)

The URL of this application's role connection verification entry point.

rpc_origins class-attribute instance-attribute #

rpc_origins: Sequence[str] | None = attrs.field(
    eq=False, hash=False, repr=False
)

A collection of this application's RPC origin URLs, if RPC is enabled.

tags class-attribute instance-attribute #

tags: Sequence[str] = attrs.field(
    eq=False, hash=False, repr=False
)

A sequence of tags describing the content and functionality of the application.

team class-attribute instance-attribute #

team: Team | None = attrs.field(
    eq=False, hash=False, repr=False
)

The team this application belongs to.

If the application is not part of a team, this will be None.

terms_of_service_url class-attribute instance-attribute #

terms_of_service_url: str | None = attrs.field(
    eq=False, hash=False, repr=False
)

The URL of this application's terms of service.

make_cover_image_url #

make_cover_image_url(
    *,
    file_format: Literal[
        "PNG", "JPEG", "JPG", "WEBP"
    ] = "PNG",
    size: int = 4096,
    lossless: bool = True,
) -> URL | None

Generate the rich presence cover image URL for this application, if set.

If no cover image is set, this returns None.

PARAMETER DESCRIPTION
file_format

The format to use for this URL.

Supports PNG, JPEG, JPG, and WEBP.

If not specified, the format will be PNG.

TYPE: Literal['PNG', 'JPEG', 'JPG', 'WEBP'] DEFAULT: 'PNG'

size

The size to set for the URL; Can be any power of two between 16 and 4096;

TYPE: int DEFAULT: 4096

lossless

Whether to return a lossless or compressed WEBP image; This is ignored if file_format is not WEBP.

TYPE: bool DEFAULT: True

RETURNS DESCRIPTION
Optional[URL]

The URL, or None if no cover image exists.

RAISES DESCRIPTION
TypeError

If an invalid format is passed for file_format.

ValueError

If size is specified but is not a power of two or not between 16 and 4096.

ApplicationContextType #

Bases: int, Enum

The context in which to install the application.

BOT_DM class-attribute instance-attribute #

BOT_DM = 1

Command can be ran inside the bot's DM.

GUILD class-attribute instance-attribute #

GUILD = 0

Command can be ran inside servers.

PRIVATE_CHANNEL class-attribute instance-attribute #

PRIVATE_CHANNEL = 2

Command can be ran inside any of the user's DM or Group DM's, other than the bot's DM.

ApplicationEventWebhookStatus #

Bases: int, Enum

The status of an application's event webhooks.

DISABLED class-attribute instance-attribute #

DISABLED = 1

Webhook events are disabled by the developer.

DISABLED_BY_DISCORD class-attribute instance-attribute #

DISABLED_BY_DISCORD = 3

Webhook events are disabled by Discord, usually due to inactivity.

ENABLED class-attribute instance-attribute #

ENABLED = 2

Webhook events are enabled by the developer.

ApplicationEventWebhookType #

Bases: str, Enum

The type of an application event webhook.

APPLICATION_AUTHORIZED class-attribute instance-attribute #

APPLICATION_AUTHORIZED = 'APPLICATION_AUTHORIZED'

Sent when an app was authorized by a user to a server or their account.

APPLICATION_DEAUTHORIZED class-attribute instance-attribute #

APPLICATION_DEAUTHORIZED = 'APPLICATION_DEAUTHORIZED'

Sent when an app was deauthorized by a user.

ENTITLEMENT_CREATE class-attribute instance-attribute #

ENTITLEMENT_CREATE = 'ENTITLEMENT_CREATE'

Sent when an entitlement was created.

ENTITLEMENT_DELETE class-attribute instance-attribute #

ENTITLEMENT_DELETE = 'ENTITLEMENT_DELETE'

Sent when an entitlement was deleted.

ENTITLEMENT_UPDATE class-attribute instance-attribute #

ENTITLEMENT_UPDATE = 'ENTITLEMENT_UPDATE'

Sent when an entitlement was updated.

GAME_DIRECT_MESSAGE_CREATE class-attribute instance-attribute #

GAME_DIRECT_MESSAGE_CREATE = 'GAME_DIRECT_MESSAGE_CREATE'

Sent when a direct message is created during an active Social SDK session.

GAME_DIRECT_MESSAGE_DELETE class-attribute instance-attribute #

GAME_DIRECT_MESSAGE_DELETE = 'GAME_DIRECT_MESSAGE_DELETE'

Sent when a direct message is deleted during an active Social SDK session.

GAME_DIRECT_MESSAGE_UPDATE class-attribute instance-attribute #

GAME_DIRECT_MESSAGE_UPDATE = 'GAME_DIRECT_MESSAGE_UPDATE'

Sent when a direct message is updated during an active Social SDK session.

LOBBY_MESSAGE_CREATE class-attribute instance-attribute #

LOBBY_MESSAGE_CREATE = 'LOBBY_MESSAGE_CREATE'

Sent when a message is created in a lobby.

LOBBY_MESSAGE_DELETE class-attribute instance-attribute #

LOBBY_MESSAGE_DELETE = 'LOBBY_MESSAGE_DELETE'

Sent when a message is deleted from a lobby.

LOBBY_MESSAGE_UPDATE class-attribute instance-attribute #

LOBBY_MESSAGE_UPDATE = 'LOBBY_MESSAGE_UPDATE'

Sent when a message is updated in a lobby.

QUEST_USER_ENROLLMENT class-attribute instance-attribute #

QUEST_USER_ENROLLMENT = 'QUEST_USER_ENROLLMENT'

Sent when a user was added to a Quest.

ApplicationFlags #

Bases: Flag

The known application flag bits.

APPLICATION_COMMAND_BADGE class-attribute instance-attribute #

APPLICATION_COMMAND_BADGE = 1 << 23

Denotes that the application has at least one global application command.

EMBEDDED class-attribute instance-attribute #

EMBEDDED = 1 << 17

Denotes that the application has functionality that's specially embedded in Discord's client.

GUILD_MEMBERS_INTENT class-attribute instance-attribute #

GUILD_MEMBERS_INTENT = 1 << 15

Denotes that the application has the GUILD_MEMBERS intent enabled in it's dashboard.

GUILD_PRESENCES_INTENT class-attribute instance-attribute #

GUILD_PRESENCES_INTENT = 1 << 13

Denotes that the application has the GUILD_PRESENCES intent enabled in it's dashboard.

MESSAGE_CONTENT_INTENT class-attribute instance-attribute #

MESSAGE_CONTENT_INTENT = 1 << 18

Denotes that the application has message content intent enabled in it's dashboard.

MESSAGE_CONTENT_INTENT_LIMITED class-attribute instance-attribute #

MESSAGE_CONTENT_INTENT_LIMITED = 1 << 19

Denotes that the application has message content access while pending verification.

VERIFICATION_PENDING_GUILD_LIMIT class-attribute instance-attribute #

VERIFICATION_PENDING_GUILD_LIMIT = 1 << 16

Denotes that the application's verification is pending.

VERIFIED_FOR_GUILD_MEMBERS_INTENT class-attribute instance-attribute #

VERIFIED_FOR_GUILD_MEMBERS_INTENT = 1 << 14

Denotes that a verified application can use the GUILD_MEMBERS intent.

VERIFIED_FOR_GUILD_PRESENCES class-attribute instance-attribute #

VERIFIED_FOR_GUILD_PRESENCES = 1 << 12

Denotes that a verified application can use the GUILD_PRESENCES intent.

ApplicationInstallParameters #

Represents the application install parameters.

permissions class-attribute instance-attribute #

permissions: Permissions = attrs.field(
    eq=True, repr=False, hash=True
)

The permissions to add the bot to guild with.

scopes class-attribute instance-attribute #

scopes: Sequence[str] = attrs.field(
    eq=True, repr=False, hash=True
)

The scopes to authorize the bot for.

ApplicationIntegrationConfiguration #

The Application Integration Configuration for the related [ApplicationIntegrationType][].

oauth2_install_parameters class-attribute instance-attribute #

oauth2_install_parameters: (
    OAuth2InstallParameters | None
) = attrs.field(eq=False, hash=False, repr=True)

The OAuth2 Install parameters for the Application Integration.

ApplicationIntegrationType #

Bases: int, Enum

Where an application can be installed.

GUILD_INSTALL class-attribute instance-attribute #

GUILD_INSTALL = 0

Application is installable to all guilds.

USER_INSTALL class-attribute instance-attribute #

USER_INSTALL = 1

Application is installable to all users.

ApplicationRoleConnectionMetadataRecord #

Represents a role connection metadata record.

description class-attribute instance-attribute #

description: str = attrs.field(
    eq=False, hash=False, repr=True
)

The metadata's field description.

description_localizations class-attribute instance-attribute #

description_localizations: Mapping[Locale | str, str] = (
    attrs.field(
        eq=False, hash=False, repr=False, factory=dict
    )
)

A mapping of description localizations for this metadata field.

key class-attribute instance-attribute #

key: str = attrs.field(eq=True, hash=True, repr=False)

Dictionary key for the metadata field.

name class-attribute instance-attribute #

name: str = attrs.field(eq=False, hash=False, repr=True)

The metadata's field name.

name_localizations class-attribute instance-attribute #

name_localizations: Mapping[Locale | str, str] = (
    attrs.field(
        eq=False, hash=False, repr=False, factory=dict
    )
)

A mapping of name localizations for this metadata field.

type class-attribute instance-attribute #

type: ApplicationRoleConnectionMetadataRecordType | int = (
    attrs.field(eq=False, hash=False, repr=False)
)

The type of metadata value record.

ApplicationRoleConnectionMetadataRecordType #

Bases: int, Enum

Represents possible application role connection metadata record types.

BOOLEAN_EQUAL class-attribute instance-attribute #

BOOLEAN_EQUAL = 7

Boolean Equal.

BOOLEAN_NOT_EQUAL class-attribute instance-attribute #

BOOLEAN_NOT_EQUAL = 8

Boolean Not Equal.

DATETIME_GREATER_THAN_OR_EQUAL class-attribute instance-attribute #

DATETIME_GREATER_THAN_OR_EQUAL = 6

Datetime Greater Than Or Equal.

DATETIME_LESS_THAN_OR_EQUAL class-attribute instance-attribute #

DATETIME_LESS_THAN_OR_EQUAL = 5

Datetime Less Than Or Equal.

INTEGER_EQUAL class-attribute instance-attribute #

INTEGER_EQUAL = 3

Integer Equal.

INTEGER_GREATER_THAN_OR_EQUAL class-attribute instance-attribute #

INTEGER_GREATER_THAN_OR_EQUAL = 2

Integer Greater Than Or Equal.

INTEGER_LESS_THAN_OR_EQUAL class-attribute instance-attribute #

INTEGER_LESS_THAN_OR_EQUAL = 1

Integer Less Than Or Equal.

INTEGER_NOT_EQUAL class-attribute instance-attribute #

INTEGER_NOT_EQUAL = 4

Integer Not Equal.

AuthorizationApplication #

Bases: PartialApplication

The application model found attached to hikari.applications.AuthorizationInformation.

is_bot_code_grant_required class-attribute instance-attribute #

is_bot_code_grant_required: bool | None = attrs.field(
    eq=False, hash=False, repr=False
)

True if this application's bot is requiring code grant for invites.

Will be None if this application doesn't have a bot.

is_bot_public class-attribute instance-attribute #

is_bot_public: bool | None = attrs.field(
    eq=False, hash=False, repr=True
)

True if the bot associated with this application is public.

Will be None if this application doesn't have an associated bot.

privacy_policy_url class-attribute instance-attribute #

privacy_policy_url: str | None = attrs.field(
    eq=False, hash=False, repr=False
)

The URL of this application's privacy policy.

public_key class-attribute instance-attribute #

public_key: bytes = attrs.field(
    eq=False, hash=False, repr=False
)

The key used for verifying interaction and GameSDK payload signatures.

terms_of_service_url class-attribute instance-attribute #

terms_of_service_url: str | None = attrs.field(
    eq=False, hash=False, repr=False
)

The URL of this application's terms of service.

AuthorizationInformation #

Model for the data returned by Get Current Authorization Information.

application class-attribute instance-attribute #

application: AuthorizationApplication = attrs.field(
    hash=False, repr=True
)

The current application.

expires_at class-attribute instance-attribute #

expires_at: datetime = attrs.field(hash=False, repr=True)

When the access token this data was retrieved with expires.

scopes class-attribute instance-attribute #

scopes: Sequence[OAuth2Scope | str] = attrs.field(
    hash=False, repr=True
)

A sequence of the scopes the current user has authorized the application for.

user class-attribute instance-attribute #

user: User | None = attrs.field(hash=False, repr=True)

The user who has authorized this token.

This will only be included if the token is authorized for the hikari.applications.OAuth2Scope.IDENTIFY scope.

ConnectionVisibility #

Bases: int, Enum

Describes who can see a connection with a third party account.

EVERYONE class-attribute instance-attribute #

EVERYONE = 1

Everyone can see the connection.

NONE class-attribute instance-attribute #

NONE = 0

Implies that only you can see the corresponding connection.

InviteApplication #

Bases: PartialApplication

Represents the information of an Invite Application.

app class-attribute instance-attribute #

app: RESTAware = attrs.field(
    repr=False,
    eq=False,
    hash=False,
    metadata={attrs_extensions.SKIP_DEEP_COPY: True},
)

Client application that models may use for procedures.

cover_image_hash class-attribute instance-attribute #

cover_image_hash: str | None = attrs.field(
    eq=False, hash=False, repr=False
)

The CDN's hash of this application's default rich presence invite cover image.

public_key class-attribute instance-attribute #

public_key: bytes = attrs.field(
    eq=False, hash=False, repr=False
)

The key used for verifying interaction and GameSDK payload signatures.

make_cover_image_url #

make_cover_image_url(
    *,
    file_format: Literal[
        "PNG", "JPEG", "JPG", "WEBP"
    ] = "PNG",
    size: int = 4096,
    lossless: bool = True,
) -> URL | None

Generate the rich presence cover image URL for this application, if set.

If no cover image is set, this returns None.

PARAMETER DESCRIPTION
file_format

The format to use for this URL.

Supports PNG, JPEG, JPG, and WEBP.

If not specified, the format will be PNG.

TYPE: Literal['PNG', 'JPEG', 'JPG', 'WEBP'] DEFAULT: 'PNG'

size

The size to set for the URL; Can be any power of two between 16 and 4096;

TYPE: int DEFAULT: 4096

lossless

Whether to return a lossless or compressed WEBP image; This is ignored if file_format is not WEBP.

TYPE: bool DEFAULT: True

RETURNS DESCRIPTION
Optional[URL]

The URL, or None if no cover image is set.

RAISES DESCRIPTION
TypeError

If an invalid format is passed for file_format.

ValueError

If size is specified but is not a power of two or not between 16 and 4096.

OAuth2AuthorizationToken #

Bases: PartialOAuth2Token

Model for the OAuth2 token data returned by the authorization grant flow.

guild class-attribute instance-attribute #

guild: RESTGuild | None = attrs.field(
    eq=False, hash=False, repr=True
)

Object of the guild the user was added to.

This will only be present if this token was authorized with the hikari.applications.OAuth2Scope.BOT scope, otherwise this will be None.

refresh_token class-attribute instance-attribute #

refresh_token: str = attrs.field(
    eq=False, hash=False, repr=False
)

Refresh token used to obtain new access tokens with the same grant.

webhook class-attribute instance-attribute #

webhook: IncomingWebhook | None = attrs.field(
    eq=False, hash=False, repr=True
)

Object of the webhook that was created.

This will only be present if this token was authorized with the hikari.applications.OAuth2Scope.WEBHOOK_INCOMING scope, otherwise this will be None.

OAuth2ImplicitToken #

Bases: PartialOAuth2Token

Model for the OAuth2 token data returned by the implicit grant flow.

state class-attribute instance-attribute #

state: str | None = attrs.field(
    eq=False, hash=False, repr=False
)

State parameter that was present in the authorization request if provided.

OAuth2InstallParameters #

OAuth2 Install Parameters.

permissions class-attribute instance-attribute #

permissions: Permissions = attrs.field(
    eq=False, hash=False, repr=True
)

The permissions that will be requested for the bot role.

scopes class-attribute instance-attribute #

scopes: Sequence[OAuth2Scope] = attrs.field(
    eq=False, hash=False, repr=True
)

The scopes the application will be added to the server with.

OAuth2Scope #

Bases: str, 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 hikari.applications.OAuth2Scope.BOT scope when developing bots.

ACTIVITIES_READ class-attribute instance-attribute #

ACTIVITIES_READ = 'activities.read'

Enables fetching the "Now Playing/Recently Played" list.

Note

You must be whitelisted to use this scope.

ACTIVITIES_WRITE class-attribute instance-attribute #

ACTIVITIES_WRITE = 'activities.write'

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 class-attribute instance-attribute #

APPLICATIONS_BUILDS_READ = 'applications.builds.read'

Enables reading build data for a user's applications.

Note

You must be whitelisted to use this scope.

APPLICATIONS_BUILDS_UPLOAD class-attribute instance-attribute #

APPLICATIONS_BUILDS_UPLOAD = 'applications.builds.upload'

Enables uploading/updating builds for a user's applications.

Note

You must be whitelisted to use this scope.

APPLICATIONS_COMMANDS class-attribute instance-attribute #

APPLICATIONS_COMMANDS = 'applications.commands'

Allows your application's commands to be used in a guild.

This is used in Discord's special Bot Authorization Flow like hikari.applications.OAuth2Scope.BOT in-order to join an application into a guild as an application command providing integration.

APPLICATIONS_COMMANDS_PERMISSION_UPDATE class-attribute instance-attribute #

APPLICATIONS_COMMANDS_PERMISSION_UPDATE = (
    "applications.commands.permissions.update"
)

Allows your application to update its commands permissions via a bearer token.

APPLICATIONS_COMMANDS_UPDATE class-attribute instance-attribute #

APPLICATIONS_COMMANDS_UPDATE = (
    "applications.commands.update"
)

Allows your application to update its commands via a bearer token.

APPLICATIONS_ENTITLEMENTS class-attribute instance-attribute #

APPLICATIONS_ENTITLEMENTS = 'applications.entitlements'

Enables reading entitlements for a user's applications.

APPLICATIONS_STORE_UPDATE class-attribute instance-attribute #

APPLICATIONS_STORE_UPDATE = 'applications.store.update'

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 class-attribute instance-attribute #

BOT = 'bot'

Enables adding a bot application to a guild.

Note

This requires you to have set up a bot account for your application.

CONNECTIONS class-attribute instance-attribute #

CONNECTIONS = 'connections'

Enables viewing third-party linked accounts such as Twitch.

EMAIL class-attribute instance-attribute #

EMAIL = 'email'

Enable the application to view the user's email and application info.

GROUP_DM_JOIN class-attribute instance-attribute #

GROUP_DM_JOIN = 'gdm.join'

Enables joining users into a group DM.

Warning

This cannot add the bot to a group DM.

GUILDS class-attribute instance-attribute #

GUILDS = 'guilds'

Enables viewing the guilds the user is in.

GUILDS_JOIN class-attribute instance-attribute #

GUILDS_JOIN = 'guilds.join'

Enables adding the user to a specific guild.

Note

This requires you to have set up a bot account for your application.

GUILDS_MEMBERS_READ class-attribute instance-attribute #

GUILDS_MEMBERS_READ = 'guilds.members.read'

Used to read the current user's guild members.

IDENTIFY class-attribute instance-attribute #

IDENTIFY = 'identify'

Enables viewing info about itself.

Note

This does not include email address info. Use the hikari.applications.OAuth2Scope.EMAIL scope instead to retrieve this information.

RELATIONSHIPS_READ class-attribute instance-attribute #

RELATIONSHIPS_READ = 'relationships.read'

Enables viewing a user's friend list.

Note

You must be whitelisted to use this scope.

ROLE_CONNECTIONS_WRITE class-attribute instance-attribute #

ROLE_CONNECTIONS_WRITE = 'role_connections.write'

Used to write to the current user's connection and metadata for the app.

RPC class-attribute instance-attribute #

RPC = 'rpc'

Enables the RPC application to control the local user's Discord client.

Note

You must be whitelisted to use this scope.

RPC_MESSAGES_READ class-attribute instance-attribute #

RPC_MESSAGES_READ = 'messages.read'

Enables the RPC application to read messages from all channels the user is in.

RPC_NOTIFICATIONS_READ class-attribute instance-attribute #

RPC_NOTIFICATIONS_READ = 'rpc.notifications.read'

Enables the RPC application to read from all channels the user is in.

Note

You must be whitelisted to use this scope.

WEBHOOK_INCOMING class-attribute instance-attribute #

WEBHOOK_INCOMING = 'webhook.incoming'

Used to generate a webhook that is returned in the OAuth2 token response.

This is used during authorization code grants.

OwnApplicationRoleConnection #

Represents an own application role connection.

metadata class-attribute instance-attribute #

metadata: Mapping[str, str] = attrs.field(
    eq=False, hash=False, repr=False
)

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 an int. - DATETIME_X: Cast to datetime.datetime.fromisoformat or ciso8601.parse_rfc3339 (for speed). - BOOLEAN_X: Cast to a bool.

platform_name class-attribute instance-attribute #

platform_name: str | None = attrs.field(
    eq=True, hash=True, repr=True
)

The name of the platform.

platform_username class-attribute instance-attribute #

platform_username: str | None = attrs.field(
    eq=True, hash=True, repr=True
)

The users name in the platform.

OwnConnection #

Represents a user's connection with a third party account.

Returned by the GET Current User Connections endpoint.

id class-attribute instance-attribute #

id: str = attrs.field(hash=True, repr=True)

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 class-attribute instance-attribute #

integrations: Sequence[PartialIntegration] = attrs.field(
    eq=False, hash=False, repr=False
)

A sequence of the partial guild integration objects this connection has.

is_activity_visible class-attribute instance-attribute #

is_activity_visible: bool = attrs.field(
    eq=False, hash=False, repr=False
)

True if this connection's activities are shown in the user's presence.

is_friend_sync_enabled class-attribute instance-attribute #

is_friend_sync_enabled: bool = attrs.field(
    eq=False, hash=False, repr=False
)

True if friends should be added based on this connection.

is_revoked class-attribute instance-attribute #

is_revoked: bool = attrs.field(
    eq=False, hash=False, repr=False
)

True if the connection has been revoked.

is_verified class-attribute instance-attribute #

is_verified: bool = attrs.field(
    eq=False, hash=False, repr=False
)

True if the connection has been verified.

name class-attribute instance-attribute #

name: str = attrs.field(eq=False, hash=False, repr=True)

The username of the connected account.

type class-attribute instance-attribute #

type: str = attrs.field(eq=False, hash=False, repr=True)

The type of service this connection is for.

visibility class-attribute instance-attribute #

visibility: ConnectionVisibility | int = attrs.field(
    eq=False, hash=False, repr=True
)

The visibility of the connection.

OwnGuild #

Bases: PartialGuild

Represents a user bound partial guild object.

approximate_active_member_count class-attribute instance-attribute #

approximate_active_member_count: int = attrs.field(
    eq=False, hash=False, repr=True
)

The approximate amount of presences in this guild.

approximate_member_count class-attribute instance-attribute #

approximate_member_count: int = attrs.field(
    eq=False, hash=False, repr=True
)

The approximate amount of members in this guild.

features class-attribute instance-attribute #

features: Sequence[str | GuildFeature] = attrs.field(
    eq=False, hash=False, repr=False
)

A list of the features in this guild.

is_owner class-attribute instance-attribute #

is_owner: bool = attrs.field(
    eq=False, hash=False, repr=True
)

True when the current user owns this guild.

my_permissions class-attribute instance-attribute #

my_permissions: Permissions = attrs.field(
    eq=False, hash=False, repr=False
)

The guild-level permissions that apply to the current user or bot.

PartialOAuth2Token #

Model for partial OAuth2 token data returned by the API.

This will generally only be returned when by the client credentials OAuth2 flow.

access_token class-attribute instance-attribute #

access_token: str = attrs.field(hash=True, repr=False)

Access token issued by the authorization server.

expires_in class-attribute instance-attribute #

expires_in: timedelta = attrs.field(
    eq=False, hash=False, repr=True
)

Lifetime of this access token.

scopes class-attribute instance-attribute #

scopes: Sequence[OAuth2Scope | str] = attrs.field(
    eq=False, hash=False, repr=True
)

Scopes the access token has access to.

token_type class-attribute instance-attribute #

token_type: TokenType | str = attrs.field(
    eq=False, hash=False, repr=True
)

Type of token issued by the authorization server.

Team #

Bases: Unique

Represents a development team, along with all its members.

app class-attribute instance-attribute #

app: RESTAware = attrs.field(
    repr=False,
    eq=False,
    hash=False,
    metadata={attrs_extensions.SKIP_DEEP_COPY: True},
)

Client application that models may use for procedures.

icon_hash class-attribute instance-attribute #

icon_hash: str | None = attrs.field(
    eq=False, hash=False, repr=False
)

The CDN hash of this team's icon.

If no icon is provided, this will be None.

id class-attribute instance-attribute #

id: Snowflake = attrs.field(hash=True, repr=True)

The ID of this entity.

members class-attribute instance-attribute #

members: Mapping[Snowflake, TeamMember] = attrs.field(
    eq=False, hash=False, repr=False
)

A mapping containing each member in this team.

The mapping maps keys containing the member's ID to values containing the member object.

name class-attribute instance-attribute #

name: str = attrs.field(hash=False, eq=False, repr=True)

The name of this team.

owner_id class-attribute instance-attribute #

owner_id: Snowflake = attrs.field(
    eq=False, hash=False, repr=True
)

The ID of this team's owner.

make_icon_url #

make_icon_url(
    *,
    file_format: Literal[
        "PNG", "JPEG", "JPG", "WEBP"
    ] = "PNG",
    size: int = 4096,
    lossless: bool = True,
) -> URL | None

Generate the icon URL for this team, if set.

If no icon is set, this returns None.

PARAMETER DESCRIPTION
file_format

The format to use for this URL.

Supports PNG, JPEG, JPG, and WEBP.

If not specified, the format will be PNG.

TYPE: Literal['PNG', 'JPEG', 'JPG', 'WEBP'] DEFAULT: 'PNG'

size

The size to set for the URL; Can be any power of two between 16 and 4096;

TYPE: int DEFAULT: 4096

lossless

Whether to return a lossless or compressed WEBP image; This is ignored if file_format is not WEBP.

TYPE: bool DEFAULT: True

RETURNS DESCRIPTION
Optional[URL]

The URL, or None if no icon is set.

RAISES DESCRIPTION
TypeError

If an invalid format is passed for file_format.

ValueError

If size is specified but is not a power of two or not between 16 and 4096.

TeamMember #

Bases: User

Represents a member of a Team.

accent_color property #

accent_color: Color | None

The custom banner color for the user, if set else None.

The official client will decide the default color if not set.

app property #

app: RESTAware

Return the app that is bound to the user object.

avatar_decoration property #

avatar_decoration: AvatarDecoration | None

Avatar decoration for the user, if they have one, otherwise None.

avatar_hash property #

avatar_hash: str | None

Avatar hash for the user, if they have one, otherwise None.

banner_hash property #

banner_hash: str | None

Banner hash for the user, if they have one, otherwise None.

default_avatar_url property #

default_avatar_url: URL

Default avatar URL for this user.

discriminator property #

discriminator: str

Discriminator for the user.

!!! deprecated 2.0.0.dev120 Discriminators are deprecated and being replaced with "0" by Discord during username migration. This field will be removed after migration is complete. Learn more here: https://dis.gd/usernames

flags property #

flags: UserFlag

Flag bits that are set for the user.

global_name property #

global_name: str | None

Global name for the user, if they have one, otherwise None.

id property #

ID of this entity.

is_bot property #

is_bot: bool

Whether this user is a bot account.

is_system property #

is_system: bool

Whether this user is a system account.

membership_state class-attribute instance-attribute #

membership_state: TeamMembershipState | int = attrs.field(
    repr=False
)

The state of this user's membership.

mention property #

mention: str

Return a raw mention string for the given user.

Examples:

>>> some_user.mention
'<@123456789123456789>'

permissions class-attribute instance-attribute #

permissions: Sequence[str] = attrs.field(repr=False)

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.

primary_guild property #

primary_guild: PrimaryGuild | None

The users primary guild tag.

team_id class-attribute instance-attribute #

team_id: Snowflake = attrs.field(repr=True)

The ID of the team this member belongs to.

user class-attribute instance-attribute #

user: User = attrs.field(repr=True)

The user representation of this team member.

username property #

username: str

Username for the user.

make_avatar_url #

make_avatar_url(
    *,
    file_format: UndefinedOr[
        Literal[
            "PNG", "JPEG", "JPG", "WEBP", "AWEBP", "GIF"
        ]
    ] = UNDEFINED,
    size: int = 4096,
    lossless: bool = True,
) -> URL | None

Generate the avatar URL for this user, if set.

If no avatar is set, this returns None.

PARAMETER DESCRIPTION
file_format

The format to use for this URL.

Supports PNG, JPEG, JPG, WEBP, AWEBP and GIF.

If not specified, the format will be determined based on whether the avatar is animated or not.

TYPE: UndefinedOr[Literal['PNG', 'JPEG', 'JPG', 'WEBP', 'AWEBP', 'GIF']] DEFAULT: UNDEFINED

size

The size to set for the URL; Can be any power of two between 16 and 4096;

TYPE: int DEFAULT: 4096

lossless

Whether to return a lossless or compressed WEBP image; This is ignored if file_format is not WEBP or AWEBP.

TYPE: bool DEFAULT: True

RETURNS DESCRIPTION
Optional[URL]

The URL, or None if no avatar is set.

RAISES DESCRIPTION
TypeError

If an invalid format is passed for file_format; If an animated format is requested for a static avatar.

ValueError

If size is specified but is not a power of two or not between 16 and 4096.

make_banner_url #

make_banner_url(
    *,
    file_format: UndefinedOr[
        Literal[
            "PNG", "JPEG", "JPG", "WEBP", "AWEBP", "GIF"
        ]
    ] = UNDEFINED,
    size: int = 4096,
    lossless: bool = True,
) -> URL | None

Generate the banner URL for this user, if set.

If no banner is set, this returns None.

PARAMETER DESCRIPTION
file_format

The format to use for this URL.

Supports PNG, JPEG, JPG, WEBP, AWEBP and GIF.

If not specified, the format will be determined based on whether the banner is animated or not.

TYPE: UndefinedOr[Literal['PNG', 'JPEG', 'JPG', 'WEBP', 'AWEBP', 'GIF']] DEFAULT: UNDEFINED

size

The size to set for the URL; Can be any power of two between 16 and 4096;

TYPE: int DEFAULT: 4096

lossless

Whether to return a lossless or compressed WEBP image; This is ignored if file_format is not WEBP or AWEBP.

TYPE: bool DEFAULT: True

RETURNS DESCRIPTION
Optional[URL]

The URL, or None if no banner is set.

RAISES DESCRIPTION
TypeError

If an invalid format is passed for file_format; If an animated format is requested for a static banner.

ValueError

If size is specified but is not a power of two or not between 16 and 4096.

TeamMembershipState #

Bases: int, Enum

Represents the state of a user's team membership.

ACCEPTED class-attribute instance-attribute #

ACCEPTED = 2

Denotes the user has accepted the invite and is now a member.

INVITED class-attribute instance-attribute #

INVITED = 1

Denotes the user has been invited to the team but has yet to accept.

TokenType #

Bases: str, Enum

Token types used within Hikari clients.

BASIC class-attribute instance-attribute #

BASIC = 'Basic'

OAuth2 basic token type.

BEARER class-attribute instance-attribute #

BEARER = 'Bearer'

OAuth2 bearer token type.

BOT class-attribute instance-attribute #

BOT = 'Bot'

Bot token type.

get_token_id #

get_token_id(token: str) -> Snowflake

Try to get the bot ID stored in a token.

RETURNS DESCRIPTION
Snowflake

The ID that was extracted from the token.

RAISES DESCRIPTION
ValueError

If the passed token has an unexpected format.