Rewards

gd.py has interface that allows fetching chests and quests:

Example:

client = gd.Client()

await client.login("user", "password")  # must be logged in

chests = await client.get_chests()
# [<Chest id=... orbs=... diamonds=... shard_id=... shard_type=... keys=... count=... delta=h:m:s>, ...]

quests = await client.get_quests()
# [<Quest id=... name=... type=... amount=... reward=... delta=h:m:s>, ...]

Chest

class gd.Chest(**options)[source]

Class that represents reward chests in Geometry Dash. This class is derived from AbstractEntity.

x == y

Check if two objects are equal. Compared by hash and type.

x != y

Check if two objects are not equal.

str(x)

Return human-readable representation of the chest, like Chest; count: 13, new in 00:00:42.000000.

repr(x)

Return representation of the chest, useful for debugging.

hash(x)

Returns hash(self.hash_str).

classmethod from_model(model: gd.model.ChestModel, *, client: Optional[Client] = None, count: int = 0, seconds: int = 0)Chest[source]

Create new entity from given model, args and kwargs.

property orbs

Amount of orbs the chest will give.

Type

int

property diamonds

Amount of diamonds the chest will give.

Type

int

property shard_id

ID of shard the chest will give.

Type

int

property shard_type

Type of the shard the chest will give.

Type

ShardType

property keys

Amount of keys the chest will give.

Type

int

property count

Amount of chests already opened.

Type

int

property seconds

Amount of seconds until next chest can be opened.

Type

int

property delta

Amount of seconds until next chest, wrapped in delta.

Type

datetime.timedelta

property ready_at

Timestamp after which the chest can be opened.

Type

datetime.datetime

attach_client(client: Optional[Client] = None)AbstractEntityT

Attach client to self.

Parameters

client (Optional[gd.Client]) – Client to attach. If None or not given, will be detached.

Returns

This abstract entity.

Return type

AbstractEntity

property client

Client attached to this object. This checks if client is not present, and raises ClientException in that case.

Type

Client

property client_unchecked

Client attached to this object.

Type

Optional[Client]

detach_client()AbstractEntityT

Detach client from self.

Same as calling:

self.attach_client(None)
Returns

This abstract entity.

Return type

AbstractEntity

classmethod from_dict(*data: Dict[str, Any], client: Optional[Client] = None, **kwargs)AbstractEntityT

Create new entity from dictionaries in data, with client and kwargs.

classmethod from_dicts(*data: Dict[str, Any], client: Optional[Client] = None, **kwargs)AbstractEntityT

Create new entity from dictionaries in data, with client and kwargs.

classmethod from_models(*models: gd.model_backend.Model, **kwargs)AbstractEntityT

Create new entity from given models by calling from_model with kwargs.

property hash_str

String used for hashing, with format <Class(ID->id)>.

Type

str

property id

ID of the Entity.

Type

int

to_dict()Dict[str, Any]

Convert the entity to a dictionary.

update_inner(**options: Any)AbstractEntityT

Update self.options with options.

Quest

class gd.Quest(**kwargs)[source]

Class that represents quests, or challenges, in Geometry Dash. This class is derived from AbstractEntity.

x == y

Check if two objects are equal. Compared by hash and type.

x != y

Check if two objects are not equal.

str(x)

Return human-readable representation of the quest, like Quest Name; collect: 100 orbs, reward: 10, new in 00:00:13.000000.

repr(x)

Return representation of the quest, useful for debugging.

hash(x)

Returns hash(self.hash_str).

classmethod from_model(model: gd.model.QuestModel, *, client: Optional[Client] = None, seconds: int = 0)Quest[source]

Create new entity from given model, args and kwargs.

property type

Type of a quest requirement.

Type

QuestType

property amount

Amount of items to collect.

Type

int

property reward

Amount of diamonds in reward.

Type

int

property name

Name of the quest.

Type

str

property seconds

Seconds until next quest pack.

Type

int

property delta

Delta until next quest pack.

Type

datetime.timedelta

property new_at

datetime.datetime Timestamp after which next quest pack can be fetched.

attach_client(client: Optional[Client] = None)AbstractEntityT

Attach client to self.

Parameters

client (Optional[gd.Client]) – Client to attach. If None or not given, will be detached.

Returns

This abstract entity.

Return type

AbstractEntity

property client

Client attached to this object. This checks if client is not present, and raises ClientException in that case.

Type

Client

property client_unchecked

Client attached to this object.

Type

Optional[Client]

detach_client()AbstractEntityT

Detach client from self.

Same as calling:

self.attach_client(None)
Returns

This abstract entity.

Return type

AbstractEntity

classmethod from_dict(*data: Dict[str, Any], client: Optional[Client] = None, **kwargs)AbstractEntityT

Create new entity from dictionaries in data, with client and kwargs.

classmethod from_dicts(*data: Dict[str, Any], client: Optional[Client] = None, **kwargs)AbstractEntityT

Create new entity from dictionaries in data, with client and kwargs.

classmethod from_models(*models: gd.model_backend.Model, **kwargs)AbstractEntityT

Create new entity from given models by calling from_model with kwargs.

property hash_str

String used for hashing, with format <Class(ID->id)>.

Type

str

property id

ID of the Entity.

Type

int

to_dict()Dict[str, Any]

Convert the entity to a dictionary.

update_inner(**options: Any)AbstractEntityT

Update self.options with options.