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]
await account_id_to_user_id(accountid) → int[source]

Convert a user id to an account id

await ban_user(userid: int) → None[source]

Ban a user

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

Decorator to create commands

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

Create a command

await create_user_object(account_id: int) → objects.accounts.Account[source]

Create a users object

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_object(account_id: int) → objects.accounts.Account[source]

Get a users object

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

Get the rank of a user

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

Get the current weekly level

await like_level(id: int)[source]

Bump a level’s likes by one

on_comment(name: str = None, permission: constants.Permissions = None)[source]

Decorator to create on_comment commands

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 send_message(subject: str, body: str, fromuser: int, touser: int) → None[source]

Send a message to a user

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 a user id