Integration

Represents a Discord Integration.

Attributes

enabled : bool

Whether this integration is enabled.

id : int

The unique identifier number of the integration.

type specific information of the integration.

name : str

The name of the integration.

The type of the integration.

User for who the integration is.

Properties

account

application

created_at

When the entity was created.

Returns

created_at : datetime

expire_behavior

expire_grace_period

partial

Returns whether the integration is partial.

Returns

partial : bool

revoked

role

Returns the integration's role.

Returns

role : None, Role

role_id

scopes

subscriber_count

synced_at

syncing

Methods

__new__(...)

Creates a new integration from the given keyword parameters.

ParameterTypeOptionalKeyword onlyDescription
integration_type

str, IntegrationType

The integration's type.

enabled

bool

Whether this integration is enabled.

name

str

The name of the integration.

user

ClientUserBase

User for who the integration is.

**keyword_parameters

Keyword parameters

keyword parameters to set the integration's attributes as.

account

IntegrationAccount, ClientUserBase

The integration's respective account. If the integration type is 'discord', then set as a discord user itself.

application

IntegrationApplication

The application of the integration if applicable.

expire_behavior

int, IntegrationExpireBehavior

The behavior of expiring subscription.

expire_grace_period

int

The grace period in days for expiring subscribers.

role_id

int

The role's identifier what the integration uses for subscribers.

scopes

None, iterable of (str, Oauth2Scope) items

The scopes the application was authorized with.

subscriber_count

int

How many subscribers the integration has.

synced_at

None, datetime

When the integration was last synced.

syncing

bool

Whether the integration syncing.

Returns

self : instance<cls>

Raises

TypeError

  • Parameter type incorrect.
  • Extra or unused parameters.

ValueError

  • Parameter value incorrect.

copy()

Copies the integration.

Returns

new : instance<type<self>>

copy_with(...)

Copies the integration account with the given fields.

ParameterTypeOptionalKeyword onlyDescription
integration_type

str, IntegrationType

The integration's type.

enabled

bool

Whether this integration is enabled.

name

str

The name of the integration.

user

ClientUserBase

User for who the integration is.

**keyword_parameters

Keyword parameters

keyword parameters to set the integration's attributes as.

account

IntegrationAccount, ClientUserBase

The integration's respective account. If the integration type is 'discord', then set as a discord user itself.

application

IntegrationApplication

The application of the integration if applicable.

expire_behavior

int, IntegrationExpireBehavior

The behavior of expiring subscription.

expire_grace_period

int

The grace period in days for expiring subscribers.

role_id

int

The role's identifier what the integration uses for subscribers.

scopes

None, iterable of (str, Oauth2Scope) items

The scopes the application was authorized with.

subscriber_count

int

How many subscribers the integration has.

synced_at

None, datetime

When the integration was last synced.

syncing

bool

Whether the integration syncing.

Returns

self : instance<cls>

Raises

TypeError

  • Parameter type incorrect.
  • Extra or unused parameters.

ValueError

  • Parameter value incorrect.

from_data(data)

Creates a new integration object with the given data. If the integration already exists, then updates and returns that instead.

ParameterTypeDescription
data

dict of (str, object) items

Integration data received from Discord.

Returns

integration : instance<cls>

precreate(integration_id, ...)

ParameterTypeOptionalKeyword onlyDescription
integration_id

int

The integration's identifier.

integration_type

str, IntegrationType

The integration's type.

**keyword_parameters

Keyword parameters

keyword parameters to set the integration's attributes as.

account

IntegrationAccount, ClientUserBase

The integration's respective account. If the integration type is 'discord', then set as a discord user itself.

application

IntegrationApplication

The application of the integration if applicable.

enabled

bool

Whether this integration is enabled.

expire_behavior

int, IntegrationExpireBehavior

The behavior of expiring subscription.

expire_grace_period

int

The grace period in days for expiring subscribers.

name

str

The name of the integration.

role_id

int

The role's identifier what the integration uses for subscribers.

scopes

None, iterable of (str, Oauth2Scope) items

The scopes the application was authorized with.

subscriber_count

int

How many subscribers the integration has.

synced_at

None, datetime

When the integration was last synced.

syncing

bool

Whether the integration syncing.

user

ClientUserBase

User for who the integration is.

Returns

self : instance<cls>

Raises

TypeError

  • Parameter type incorrect.
  • Extra or unused parameters.

ValueError

  • Parameter value incorrect.

to_data(...)

Converts the integration into a json serializable object.

ParameterTypeOptionalKeyword onlyDefaultDescription
defaults

bool

False

Whether default fields should be included as well.

include_internals

bool

False

Whether internal fields should be included as well.

Returns

data : dict of (str, object) items

_create_empty(integration_id)

Creates a new integration with it's default attributes set.

ParameterTypeDescription
integration_id

int

The integration's identifier.

Returns

self : instance<cls>

_create_with_role(integration_id, role_id)

Creates a new integration with the given role.

ParameterTypeDescription
integration_id

int

The integration's identifier.

role_id

int

The role's identifier to create the integration with.

Returns

self : instance<cls>

_get_hash_partial()

Hashes the fields of the integration.

Returns

hash_value : int

_is_equal_same_type(other)

Returns whether the two integrations are equal.

Helper method for .__eq__

ParameterTypeDescription
other

instance<type<cls>>

The other instance. Must be from the same type.

Returns

is_equal : bool

_set_attributes(data)

Sets the attributes of the integration from the given data.

.id field should be set already.

ParameterTypeDescription
data

dict of (str, object) items

Integration data received from Discord.

__eq__()

Returns whether the two integrations are equal.

__ge__()

Whether this entity's id is greater or equal than the other's.

__getattr__()

Drops a rich attribute error.

__gt__()

Whether this entity's id is greater than the other's.

__hash__()

Returns the has value of the entity, what equals to it's id.

__le__()

Whether this entity's id is less or equal than the other's.

__lt__()

Whether this entity's id is less than the other's.

__ne__()

Returns whether the two integrations are not equal.

__repr__()

Returns the integration's representation.