Comments, Friend Requests and Messages

gd.py implements reading, sending and interacting with comments, friend requests and messages:

client = gd.Client()

# we can only read comments if we are not logged in.
await client.login('username', 'password')

nekit = await client.search_user('nekitdev')
# <User account_id=5509312 id=17876467 name='nekitdev' ...>

for comment in await nekit.get_comments():
    print(comment.body)

# find some featured level by user
levels = await nekit.get_levels()

level = gd.utils.find(lambda level: level.is_featured(), levels)

# if found, print comments and post a comment
if level is not None:
    for comment in level.get_comments():
        print(comment)

    await level.comment('gd.py testing')

# print some messages
for message in await client.get_messages():
    print(message.author.name, message.subject)

# send a friend request
await nekit.send_friend_request('<sent-from-gd.py>')

# post a comment
await client.post_comment('This comment is posted using gd.py')

Comment

class gd.Comment(*, client: gd.client.Client = None, **options)[source]

Class that represents a Profile/Level comment in Geometry Dash. This class is derived from AbstractEntity.

body

Returns body of the comment.

Type

str

rating

Rating of the comment.

Type

int

timestamp

A human-readable timestamp representing how long ago the comment was created.

Type

str

author

An author of the comment.

Type

AbstractUser

type

Whether comment is on profile or on a level.

Type

CommentType

level_id

Level ID of a level the comment is on, if present. 0 if profile comment.

Type

int

level_percentage

Level highscore linked to a comment, if present. -1 if profile comment.

Type

int

color

Color of the comment. Oftenly equals gd.Color(0xffffff).

Type

Color

is_spam()bool[source]

bool: Indicates whether a comment is marked as spam. False if profile comment.

is_disliked()bool[source]

bool: Indicates whether a comment is disliked or not.

await like()None[source]

This function is a coroutine.

Likes a comment.

Raises

MissingAccess – Failed to like a comment.

await dislike()None[source]

This function is a coroutine.

Dislikes a comment.

Raises

MissingAccess – Failed to dislike a comment.

await delete()None[source]

This function is a coroutine.

Deletes a comment from Geometry Dash servers.

Obviously, only comments of client logged in using Client.login() can be deleted.

The normal behaviour of the server is returning 1 if comment was deleted, so the error is raised on response != 1.

Raises

MissingAccess – Server did not return 1, which means comment was not deleted.

Friend Request

class gd.FriendRequest(*, client: gd.client.Client = None, **options)[source]

Class that represents a friend request. This class is derived from AbstractEntity.

author

An author of the friend request.

Type

AbstractUser

recipient

A recipient of the friend request.

Type

AbstractUser

type

Whether request is incoming or sent.

Type

MessageOrRequestType

body

A string representing a message request was sent with.

Type

str

timestamp

A human-readable string representing how long ago request was created.

Type

str

is_read()bool[source]

bool: Indicates whether request was already read.

await read()None[source]

This function is a coroutine.

Read a friend request. Sets is_read to True on success.

Raises

MissingAccess – Failed to read a request.

await delete()None[source]

This function is a coroutine.

Delete a friend request.

Raises

MissingAccess – Failed to delete a request.

await accept()None[source]

This function is a coroutine.

Accept a friend request.

Raises

MissingAccess – Failed to accept a request.

Message

class gd.Message(*, client: gd.client.Client = None, **options)[source]

Class that represents private messages in Geometry Dash. This class is derived from AbstractEntity.

author

An author of the message.

Type

AbstractUser

recipient

A recipient of the message.

Type

AbstractUser

subject

A subject of the message, as string.

Type

str

timestamp

A human-readable string representing how long ago message was created.

Type

str

type

Whether a message is sent or inbox.

Type

MessageOrRequestType

body

A body of the message. Requires Message.read().

Type

Optional[str]

is_read()bool[source]

bool: Indicates whether message is read or not.

await read()str[source]

This function is a coroutine.

Read a message. Set the body of the message to the content.

Returns

The content of the message.

Return type

str

await reply(content: str, schema: Optional[str] = None)None[source]

This function is a coroutine.

Reply to the message. Format the subject according to schema.

Schema format can only contain {message.attr} elements.

Content also allows schema format.

Example:

await message.reply(
    content='Replying to message by {message.author.name}.'
    schema='Re: {message.subject} ({message.rating})'
)
await delete()None[source]

This function is a coroutine.

Delete a message.

Raises

MissingAccess – Failed to delete a message.