AllowedMentionProxy

Proxy class to interact with allowed mentions.

Attributes

_allow_everyone : int

Whether everyone mention is enabled.

_allow_replied_user : int

Whether replied user can be mentioned.

_allow_roles : int

Whether all role is enabled.

_allow_users : int

Whether all user is enabled.

_allowed_role_ids : None | list<int>

The enabled roles by the proxy.

_allowed_user_ids : None | list<int>

The enabled users by the proxy.

Properties

allow_everyone

A get-set-del property to enable or disable everyone mentions.

Accepts and returns bool-s.

allow_replied_user

A get-set-del property to enable or disable replied user mention.

Accepts and returns None and bool-s.

allow_roles

A get-set-del property to enable or disable role mentions.

Accepts and returns bool-s.

allow_users

A get-set-del property to enable or disable user mentions.

Accepts and returns bool-s.

allowed_roles

A get-set-del property to enable or disable specific role mentions.

Accepts and returns None or a list, set or tuple of Role-s.

allowed_users

A get-set-del property to enable or disable specific user mentions.

Accepts and returns None or a list, set or tuple of UserBase-s.

Methods

__new__(...)

Parses allowed mentions

ParameterTypeOptionalDescription
*allowed_mentions

str, UserBase, Role

Which user or role can the message ping (or everyone).

Raises

TypeError

If allowed_mentions contains an element of invalid type.

ValueError

If allowed_mentions contains en element of correct type, but an invalid value.

copy()

Copies the allowed mention proxy.

Returns

new : instance<type<self>>

from_data(data)

Creates a new allowed mention proxy from the given data.

ParameterTypeDescription
data

None | dict<str, object> items

Allowed mention data.

Returns

self : instance<cls>

The created allowed mention proxy.

to_data()

Converts the allowed mention proxy to json serializable object.

Returns

data : dict<str, object> items

update(other)

Updates the allowed mentions with the given value.

ParameterTypeDescription
other

str, UserBase, Role, instance<type<self>> or (list, tuple, set) of (str, UserBase, Role)

Which user or role can the message ping (or everyone).

Returns

self : instance<cls>

Raises

TypeError

If other contains an element of invalid type.

ValueError

If other contains en element of correct type, but an invalid value.

_create_from_various(other)

Creates an allowed mention proxy instance from other object.

ParameterTypeDescription
other

instance<cls> | str, (list | set | tuple)<str | UserBase, Role>

The other instance to create allowed mention proxy from.

Returns

self : instance<cls>

_subtract(self, other)

Returns an allowed mentions proxy, without elements found in other.

This is a classmethod.

ParameterTypeDescription
self

instance<type<self>>

The allowed mention proxy to subtract the other from.

other

instance<type<self>>

The allowed mention proxy to subtract.

Returns

new : instance<type<self>>

__add__()

Returns the union of the two allowed mention proxy.

__and__()

Returns the intersection of the two allowed mention proxy.

__eq__()

Returns whether the two allowed mention proxies are equal.

__getattr__()

Drops a rich attribute error.

__hash__()

Returns the allowed mention proxy's hash value.

__iter__()

Iterates back the values which with a same allowed mention proxy can be created.

This method is an iterable generator.

Yields

allowed_mentions : str, UserBase, Role

Which user or role can the message ping (or everyone).

__or__()

Returns the union of the two allowed mention proxy.

__radd__()

Returns the union of the two allowed mention proxy.

__rand__()

Returns the intersection of the two allowed mention proxy.

__repr__()

Returns the allowed mention proxy's representation.

__ror__()

Returns the union of the two allowed mention proxy.

__rsub__()

Returns an allowed mentions proxy, without elements found in self.

__rxor__()

Returns the symmetric difference of the two allowed mention proxy.

__sub__()

Returns an allowed mentions proxy, without elements found in other.

__xor__()

Returns the symmetric difference of the two allowed mention proxy.