RelationshipType

Represents a Relationship 's type.

Attributes

name : str

The relationship type's name.

value : int

The Discord side identifier value of the relationship type.

Class Attributes

DEFAULT_NAME : str = 'Undefined'

The default name of the relation types.

INSTANCES : dict of (int, RelationshipType) items

The predefined relation types stored in a list, so they can be accessed with their respective value as key. This behaviour is used to translate their Discord side value to their representation.

VALUE_TYPE : type = int

The relationship types' values' type.

Each predefined relationship type can also be accessed as class attribute:

Class attribute namenamevalue
strangerstranger0
friendfriend1
blockedblocked2
pending_incomingpending incoming3
pending_outgoingpending outgoing4
implicitimplicit5
suggestionsuggestion6

Methods

__init__(value, name)

Creates a new preinstanced instance.

ParameterTypeDescription
value

.VALUE_TYPE

The value of the preinstanced object.

name

str

The object's name.

get(value)

Returns the value's representation. If the value is already preinstanced, returns that, else creates a new object.

ParameterTypeDescription
value

None, .VALUE_TYPE

The value to get it's representation.

Returns

obj_ : PreinstancedBase

_from_value(value)

Creates a new preinstanced object from the given value.

ParameterTypeDescription
value

.VALUE_TYPE

The value what has no representation yet.

Returns

self : PreinstancedBase

The created object.

__eq__()

Returns whether self's value equals to the other object's.

__ge__()

Returns whether self's value is greater or equal to the other object's.

__getattr__()

Drops a rich attribute error.

__gt__()

Returns whether self's value is greater than the other object's.

__hash__()

Returns the hash of the preinstanced object.

__le__()

Returns whether self's value is less or equal to the other object's.

__lt__()

Returns whether self's value is less than the other object's.

__ne__()

Returns whether self's not equals to the other object's.

__repr__()

Returns the representation of the preinstanced object.