Skip to content
Pum edited this page Apr 3, 2021 · 4 revisions

How to use the library

There are three end points of the API currently:

1. Get Profile

async def get_profile():
    wrapper = tatsu.wrapper.ApiWrapper(key=APIKEY)
    result = await wrapper.get_profile(user_id)
    return result

This will return a user profile object with the following structure:

Field Type Description
avatar_hash str The avatar hash of the user.
avatar_url str The avatar url of the user.
credis int The amount of credits the user has.
discriminator str The user's discriminator.
user_id int The user ID
info_box str The users current info box
reputation int The number of reputation points the user has
subscription_type int The users subscription type. See below for more information
subscription_renewal datetime A datetime object representing the next renewal time for the users supporter.
title str The title of the profile card
tokens int The amount of tokens a user has
username str The user's username
xp int The amount of xp the user currently has
original dict The original response of the API

Subscription types

Value Description
0 No subscription
1 Supporter
2 Supporter+
3 Supporter++

Note: The renewal will be a year 0 datetime object if the user is not a supporter.

2. Get the ranking of a specified member in a specified server

async def get_member_ranking():
    wrapper = tatsu.wrapper.ApiWrapper(key=APIKEY)
    result = await wrapper.get_member_ranking(server_id, user_id)
    return result

This returns the members ranking object with the following structure:

Field Type Description
guild_id int The discord ID of the guild
rank int The user's rank
user_id int The user ID
score int The user's score
original dict The original response of the API

3. Get the guild ranks

async def get_guild_rankings():
    wrapper = tatsu.wrapper.ApiWrapper(key=APIKEY)
    result = await wrapper.get_guild_rankings(guild_id, timeframe="month", offset=0) # 
    return result

The default value for offset is 0 The default value for timeframe is all but it can also be month or week

This returns a guild rank object with the following structure:

Field Type Description
guild_id int The discord ID of the guild
Rankings [RankingObject] A list of user rank objects (maximum 100)
original dict The original response of the API