Achievement

Represents a Discord achievement created at Developer portal.

Attributes

application_id : int

The achievement's respective application's id.

description : str

The description of the achievement.

description_localizations : None, dict of (str, str) items

Localized descriptions of the achievement.

icon_hash : int

The achievement's icon's hash. Achievements always have icon.

icon_type : IconType

The achievement's icon's type.

id : int

The achievement's unique identifier number.

name : str

The name of the achievement.

name_localizations : None, dict of (str, str) items

Localized names of the achievement.

secret : bool

Secret achievements will *not* be shown to the user until they've unlocked them.

secure : bool

Secure achievements can only be set via HTTP calls from your server, not by a game client using the SDK.

Properties

created_at

When the entity was created.

Returns

created_at : datetime

icon

Returns the respective icon.

Returns

icon : Icon

icon_url

Returns the achievement's icon's url.

This function is a shared property of Achievement-s.

Returns

url : None, str

Methods

__init__(data)

Creates an achievement with the given data.

ParameterTypeDescription
data

dict of (str, object) items

Received achievement data.

icon_url_as(...)

Returns the achievement's icon's url.

This function is a shared method of Achievement-s.

ParameterTypeOptionalDefaultDescription
ext

None, str

None

The extension of the icon's url. Can be any of: 'jpg', 'jpeg', 'png', 'webp'.

size

None, int

None

The preferred minimal size of the icon's url.

Returns

url : None, str

Raises

ValueError

If ext, size was not passed as any of the expected values.

_difference_update_attributes(data)

Updates the achievement and returns it's overwritten attributes as a dict with a attribute-name- old-value relation.

ParameterTypeDescription
data

dict of (str, object) items

Achievement data received from Discord.

Returns

old_attributes : dict of (str, object) items

All item in the returned dict is optional.

Returned Data Structure

KeysValues
descriptionstr
description_localizationsNone, dict of (str, str) items
iconIcon
namestr
name_localizationsNone, dict of (str, str) items
secretbool
securebool

_update_attributes(data)

Updates the achievement with overwriting it's old attributes.

ParameterTypeDescription
data

dict of (str, object) items

Achievement data received from Discord.

__eq__()

Whether this entity's id is equal as the other's.

__format__()

Formats the achievement with the given format code.

__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__()

Whether this entity's id is not equal as the other's.

__repr__()

Returns the achievement's representation.