Connection

A connection object that a user is attached to.

Attributes

friend_sync : bool

Whether the user has friend sync enabled for the connection.

id : int

The unique identifier value of the connection.

integrations : None or tuple of Integration

A guild's integrations which are attached to the connection.

metadata_visibility : ConnectionVisibility

For who is the connection metadata visible for.

name : str

The username of the connected account.

revoked : bool

Whether the connection is revoked.

show_activity : bool

Whether activity related to this connection will be shown in presence updates.

two_way_link : bool

Whether this connection has a corresponding third party OAuth2 token.

The service of the connection.

verified : bool

Whether the connection is verified.

For who is the connection visible for.

Properties

created_at

When the entity was created.

Returns

created_at : datetime

Methods

__new__(...)

Creates a new connection from the given parameters.

ParameterTypeOptionalKeyword onlyDescription
connection_type

ConnectionType, str

The service of the connection.

friend_sync

bool

Whether the user has friend sync enabled for the connection.

integrations

None or iterable of Integration

A guild's integrations which are attached to the connection.

metadata_visibility

ConnectionVisibility, int

For who is the connection metadata visible for.

name

str

The username of the connected account.

revoked

bool

Whether the connection is revoked.

show_activity

bool

Whether activity related to this connection will be shown in presence updates.

two_way_link

bool

Whether this connection has a corresponding third party OAuth2 token.

verified

bool

Whether the connection is verified.

visibility

ConnectionVisibility, int

For who is the connection visible for.

Raises

TypeError

  • If a field's type is unacceptable.

ValueError

  • If a a field's value is unacceptable.

copy()

Copies the connection returning a new partial one.

Returns

new : instance<cls>

copy_with(...)

Copies the connection with the given fields returning a new partial one.

ParameterTypeOptionalKeyword onlyDescription
connection_type

ConnectionType, str

The service of the connection.

friend_sync

bool

Whether the user has friend sync enabled for the connection.

integrations

None or iterable of Integration

A guild's integrations which are attached to the connection.

metadata_visibility

ConnectionVisibility, int

For who is the connection metadata visible for.

name

str

The username of the connected account.

revoked

bool

Whether the connection is revoked.

show_activity

bool

Whether activity related to this connection will be shown in presence updates.

two_way_link

bool

Whether this connection has a corresponding third party OAuth2 token.

verified

bool

Whether the connection is verified.

visibility

ConnectionVisibility, int

For who is the connection visible for.

Returns

new : instance<cls>

Raises

TypeError

  • If a field's type is unacceptable.

ValueError

  • If a a field's value is unacceptable.

from_data(data)

Creates a connection object from received connection data.

ParameterTypeDescription
data

dict of (str, object)

Received connection data.

iter_integrations()

Iterates over the integrations of the connection.

This method is an iterable generator.

Yields

integration : Integration

precreate(connection_id, ...)

Creates a new connection with the given predefined fields.

Since connections are not cached globally, this method is only be used for testing.

ParameterTypeOptionalKeyword onlyDescription
connection_id

int

The connection's identifier.

**keyword_parameters

Keyword Parameters

The attributes to set.

connection_type

ConnectionType, str

The service of the connection.

friend_sync

bool

Whether the user has friend sync enabled for the connection.

integrations

None or iterable of Integration

A guild's integrations which are attached to the connection.

metadata_visibility

ConnectionVisibility, int

For who is the connection metadata visible for.

name

str

The username of the connected account.

revoked

bool

Whether the connection is revoked.

show_activity

bool

Whether activity related to this connection will be shown in presence updates.

two_way_link

bool

Whether this connection has a corresponding third party OAuth2 token.

verified

bool

Whether the connection is verified.

visibility

ConnectionVisibility, int

For who is the connection visible for.

Returns

self : instance<cls>

Raises

TypeError

  • If connection_id is not int.
  • If a field's type is unacceptable.
  • Extra or unused parameters

ValueError

  • If a a field's value is unacceptable.

to_data(...)

Converts the connection to json serializable representation dictionary.

ParameterTypeOptionalKeyword onlyDefaultDescription
defaults

bool

False

Whether default values should be included as well.

include_internals

bool

False

Whether we want to include identifiers as well.

Returns

data : dict of (str, str) items

_create_empty(connection_id)

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

ParameterTypeDescription
connection_id

int

The connection's identifier.

Returns

self : instance<cls>

_get_hash_partial()

Returns a partial connection's hash value.

Returns

hash_value : int

_is_equal_same_type(other)

Helper method for .__eq__

ParameterTypeDescription
other

instance<type<<self>>

The other instance. Must be from the same type.

Returns

is_equal : bool

__eq__()

Returns whether the two connections 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 connection's hash.

__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 connections are equal.

__repr__()

Returns the connection's representation.