Integrations

This section documents everything related to Integrations - special entities integrated into Guilds. Most common examples are bots and Twitch/YouTube integrations.

Discord Models

Integration

class disnake.Integration[source]

Represents a guild integration.

New in version 1.4.

id

The integration ID.

Type:

int

name

The integration name.

Type:

str

guild

The guild of the integration.

Type:

Guild

type

The integration type (i.e. Twitch).

Type:

str

enabled

Whether the integration is currently enabled.

Type:

bool

account

The account linked to this integration.

Type:

IntegrationAccount

user

The user that added this integration.

Type:

Optional[User]

await delete(*, reason=None)[source]

This function is a coroutine.

Deprecated since version 2.5: Can only be used on the application’s own integration and is therefore equivalent to leaving the guild.

Deletes the integration.

You must have manage_guild permission to use this.

Parameters:

reason (Optional[str]) –

The reason the integration was deleted. Shows up on the audit log.

New in version 2.0.

Raises:
  • Forbidden – You do not have permission to delete the integration.

  • HTTPException – Deleting the integration failed.

property created_at[source]

Returns the integration’s (not the associated application’s) creation time in UTC.

New in version 2.10.

Type:

datetime.datetime

IntegrationAccount

class disnake.IntegrationAccount[source]

Represents an integration account.

New in version 1.4.

id

The account ID.

Type:

str

name

The account name.

Type:

str

BotIntegration

class disnake.BotIntegration[source]

Represents a bot integration on Discord.

New in version 2.0.

id

The integration ID.

Type:

int

name

The integration name.

Type:

str

guild

The guild of the integration.

Type:

Guild

type

The integration type (i.e. Twitch).

Type:

str

enabled

Whether the integration is currently enabled.

Type:

bool

user

The user that added this integration.

Type:

User

account

The integration account information.

Type:

IntegrationAccount

application

The application tied to this integration.

Type:

IntegrationApplication

scopes

The OAuth2 scopes the application has been authorized for.

New in version 2.6.

Type:

List[str]

property created_at[source]

Returns the integration’s (not the associated application’s) creation time in UTC.

New in version 2.10.

Type:

datetime.datetime

await delete(*, reason=None)[source]

This function is a coroutine.

Deprecated since version 2.5: Can only be used on the application’s own integration and is therefore equivalent to leaving the guild.

Deletes the integration.

You must have manage_guild permission to use this.

Parameters:

reason (Optional[str]) –

The reason the integration was deleted. Shows up on the audit log.

New in version 2.0.

Raises:
  • Forbidden – You do not have permission to delete the integration.

  • HTTPException – Deleting the integration failed.

IntegrationApplication

class disnake.IntegrationApplication[source]

Represents an application for a bot integration.

New in version 2.0.

id

The application’s ID.

Type:

int

name

The application’s name.

Type:

str

icon

The application’s icon hash.

Type:

Optional[str]

description

The application’s description. Can be an empty string.

Type:

str

user

The bot user associated with this application.

Type:

Optional[User]

property summary[source]

The application’s summary. Can be an empty string.

Deprecated since version 2.5: This field is deprecated by discord and is now always blank. Consider using description instead.

Type:

str

StreamIntegration

class disnake.StreamIntegration[source]

Represents a stream integration for Twitch or YouTube.

New in version 2.0.

id

The integration ID.

Type:

int

name

The integration name.

Type:

str

guild

The guild of the integration.

Type:

Guild

type

The integration type (i.e. Twitch).

Type:

str

enabled

Whether the integration is currently enabled.

Type:

bool

syncing

Whether the integration is currently syncing.

Type:

bool

enable_emoticons

Whether emoticons should be synced for this integration (currently twitch only).

Type:

Optional[bool]

expire_behaviour

The behaviour of expiring subscribers. Aliased to expire_behavior as well.

Type:

ExpireBehaviour

expire_grace_period

The grace period (in days) for expiring subscribers.

Type:

int

user

The user for the integration.

Type:

User

account

The integration account information.

Type:

IntegrationAccount

synced_at

An aware UTC datetime representing when the integration was last synced.

Type:

datetime.datetime

property expire_behavior[source]

An alias for expire_behaviour.

Type:

ExpireBehaviour

property role[source]

Optional[Role] The role which the integration uses for subscribers.

await edit(*, expire_behaviour=..., expire_grace_period=..., enable_emoticons=...)[source]

This function is a coroutine.

Deprecated since version 2.5: No longer supported, bots cannot use this endpoint anymore.

Edits the integration.

You must have manage_guild permission to use this.

Changed in version 2.6: Raises TypeError instead of InvalidArgument.

Parameters:
  • expire_behaviour (ExpireBehaviour) – The behaviour when an integration subscription lapses. Aliased to expire_behavior as well.

  • expire_grace_period (int) – The period (in days) where the integration will ignore lapsed subscriptions.

  • enable_emoticons (bool) – Where emoticons should be synced for this integration (currently twitch only).

Raises:
await sync()[source]

This function is a coroutine.

Deprecated since version 2.5: No longer supported, bots cannot use this endpoint anymore.

Syncs the integration.

You must have manage_guild permission to use this.

Raises:
  • Forbidden – You do not have permission to sync the integration.

  • HTTPException – Syncing the integration failed.

property created_at[source]

Returns the integration’s (not the associated application’s) creation time in UTC.

New in version 2.10.

Type:

datetime.datetime

await delete(*, reason=None)[source]

This function is a coroutine.

Deprecated since version 2.5: Can only be used on the application’s own integration and is therefore equivalent to leaving the guild.

Deletes the integration.

You must have manage_guild permission to use this.

Parameters:

reason (Optional[str]) –

The reason the integration was deleted. Shows up on the audit log.

New in version 2.0.

Raises:
  • Forbidden – You do not have permission to delete the integration.

  • HTTPException – Deleting the integration failed.

PartialIntegration

class disnake.PartialIntegration[source]

Represents a partial guild integration.

New in version 2.6.

id

The integration ID.

Type:

int

name

The integration name.

Type:

str

guild

The guild of the integration.

Type:

Guild

type

The integration type (i.e. twitch).

Type:

str

account

The account linked to this integration.

Type:

IntegrationAccount

application_id

The ID of the application tied to this integration.

Type:

Optional[int]

property created_at[source]

Returns the integration’s (not the associated application’s) creation time in UTC.

New in version 2.10.

Type:

datetime.datetime

Data Classes

RawIntegrationDeleteEvent

class disnake.RawIntegrationDeleteEvent[source]

Represents the event payload for an on_raw_integration_delete() event.

New in version 2.0.

integration_id

The ID of the integration that got deleted.

Type:

int

application_id

The ID of the bot/OAuth2 application for this deleted integration.

Type:

Optional[int]

guild_id

The guild ID where the integration deletion took place.

Type:

int

Enumerations

ExpireBehaviour

class disnake.ExpireBehaviour[source]

Represents the behaviour the Integration should perform when a user’s subscription has finished.

There is an alias for this called ExpireBehavior.

New in version 1.4.

remove_role

This will remove the StreamIntegration.role from the user when their subscription is finished.

kick

This will kick the user when their subscription is finished.

Events