Client

The client class is the main class for building plugins that interact with GDPyS.

We can use the client class by importing gdpys.client to get a working client object:

import gdpys

client = gdpys.client # getting the client class

class Example(gdpys.Plugin):
    def __init__(self):
        self.set_metadata(name="example", author="spook", description="example plugin", version="1.0.0", dependencies=[])
        super().__init__()

    async def loop(self):
        user_id = 42069
        comment = "This is an account comment"
        await client.post_account_comment(user_id, comment)
        self.stop()

def setup():
    return Example

Client

class gdpys.client.Client[source]
command(name: str = None, permission: constants.Permissions = None)[source]

Decorator to create commands

create_command(name: str, coro: asyncio.coroutines.coroutine, permission: constants.Permissions)[source]

Create a command

await get_daily_level() → objects.levels.DailyLevel[source]

Get the current daily level

await get_level(id: int) → objects.levels.Level[source]

Get a level object

await get_user_rank(id: int) → int[source]

Get the rank of a user

await like_level(id: int)[source]

Bump a level’s likes by one

await post_account_comment(id: int, comment: str) → bool[source]

Post an account comment to a user’s account

await rate_level(rating: objects.levels.Rating)[source]

Rates a level given a Rating object

await star_to_difficulty(stars: int) → int[source]

Convert star rating to a difficulty

await upload_level(level: objects.levels.Level)[source]

Uploads a level from a level object

await username_to_id(username: str) → int[source]

Convert a username to an id