IconType
Represents a Discord icon's type.
Attributes details :
Additional details describing the icon type.
str
The name of the icon type.
int
The identifier value the icon type.
Class Attributes
str
= 'Undefined'
The default name of the icon types.
Stores the predefined IconType
-s. These can be accessed with their value
as key.
type
= int
The icon types' values' type.
Every predefined icon type can be accessed as class attribute as well:
Class attribute name | Name | Value | Prefix | Default postfix | Allowed Postfixes |
---|---|---|---|---|---|
none | none | 0 | '' | '' | None |
static | static | 1 | '' | 'png' | 'jpg', 'jpeg', 'png', 'webp' |
animated | animated | 2 | 'a_' | 'gif' | 'jpg', 'jpeg', 'png', 'webp', 'gif' |
animated_apng | animated apng | 3 | 'a_' | 'png' | 'png' |
Properties
allowed_postfixes
base_64_data
Returns the icon's data in base 64 encoding.
Returns
data : None
, str
data
default_postfix
media_type
prefix
Methods
(value, name, prefix, default_postfix, allowed_postfixes)
__init__Creates a new icon type with the given parameters and stores it at the type's .INSTANCES
.
Parameter | Type | Description |
---|---|---|
value |
| The unique identifier of the icon type. |
name |
| The icon type's name |
prefix |
| Prefix used when building an url with the icon. |
default_postfix |
| Default postfix used when building an url with the icon. |
allowed_postfixes |
| The allowed postfixes. |
(postfix)
allows_postfixReturns whether the icon type allows the given postfix.
Parameter | Type | Description |
---|---|---|
postfix |
| The postfix to check. |
Returns
allows_postfix : bool
()
can_create_urlReturns whether it is possible to create url with the icon.
Returns
can_create_url : bool
(data, ...)
from_dataCreates a custom icon type holding actual raw data.
Parameter | Type | Optional | Default | Description |
---|---|---|---|---|
data |
| The icon's raw data. | ||
name |
|
| The icon's name. |
Returns
self : instance<cls>
Raises
TypeError
- If
data
is notbytes-like
.
(value)
getReturns the value's representation. If the value is already preinstanced, returns that, else creates a new object.
Parameter | Type | Description |
---|---|---|
value |
| The value to get it's representation. |
Returns
obj_ : PreinstancedBase
(prefix)
get_alternative_icon_type_forTries to get the alternative icon type for the given prefix. If fails returns None
.
Parameter | Type | Description |
---|---|---|
prefix |
| Icon prefix. |
Returns
alternative_icon_type : None
, IconType
(alternative_icon_type)
register_alternative_icon_typeRegisters an alternative icon type under this one.
Parameter | Type | Description |
---|---|---|
alternative_icon_type | The icon type to register. |
(value)
_from_valueCreates a new preinstanced object from the given value.
Parameter | Type | Description |
---|---|---|
value |
| The value what has no representation yet. |
Returns
self : PreinstancedBase
The created object.
()
__bool__Returns whether the icon's type is set.
()
__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 icon detail's representation.