AmariClient
- class amari.api.AmariClient(token: str, /, *, useAntirateLimit: bool = True, session: ClientSession | None = None, max_requests: int = 60, cache_ttl: int = 60, maxbytes: int = 25600)[source]
The client used to make requests to the Amari API.
- useAntiRatelimit
Whether to use the anti ratelimit or not. IT IS VERY UNRECOMMENDED TO DISABLE THIS FEATURE AS IT CAN LEAD TO RATELIMITS
- Type:
bool
- session
The client session used to make requests to the Amari API.
- Type:
aiohttp.ClientSession
- max_requests
The number of requests that can be made per second
- Type:
int
- cache_ttl
The time to live for cache entries, in seconds.
- Type:
int
- maxbytes
The maximum total size of cached data in bytes.
- Type:
int
- async close()[source]
Closes the client resources.
This must be called once the client is no longer in use.
- async fetch_full_leaderboard(guild_id: int, /, *, weekly: bool = False, cache: bool = False) Leaderboard[source]
Fetches a guild’s full leaderboard from the Amari API.
- Parameters:
guild_id (int) – The guild ID to fetch the leaderboard from.
weekly (bool) – Choose either to fetch the weekly leaderboard or the regular leaderboard.
cache (bool) – Whether to use caching for this request.
- Returns:
The guild’s leaderboard.
- Return type:
- async fetch_leaderboard(guild_id: int, /, *, weekly: bool = False, raw: bool = False, page: int | None = None, limit: int | None = None, cache: bool = False) Leaderboard[source]
Fetches a guild’s leaderboard from the Amari API.
- Parameters:
guild_id (int) – The guild ID to fetch the leaderboard from.
weekly (bool) – Choose either to fetch the weekly leaderboard or the regular leaderboard.
raw (bool) – Whether or not to use the raw endpoint. Raw endpoints do not support pagination but will return the entire leaderboard.
page (int) – The leaderboard page to fetch.
limit (int) – The amount of users to fetch per page.
cache (bool) – Whether to use caching for this request.
- Returns:
The guild’s leaderboard.
- Return type:
- async fetch_rewards(guild_id: int, /, *, page: int = 1, limit: int = 50, cache: bool = False) Rewards[source]
Fetches a guild’s role rewards from the Amari API.
- Parameters:
guild_id (int) – The guild ID to fetch the role rewards from.
page (int) – The rewards page to fetch.
limit (int) – The amount of rewards to fetch per page.
cache (bool) – Whether to use caching for this request.
- Returns:
The guild’s role rewards.
- Return type:
- async fetch_user(guild_id: int, user_id: int, cache: bool = False) User[source]
Fetches a user from the Amari API.
- Parameters:
guild_id (int) – The guild ID to fetch the user from.
user_id (int) – The user’s ID.
cache (bool) – Whether to use caching for this request.
- Returns:
The user object.
- Return type:
- async fetch_users(guild_id: int, user_ids: List[int], cache: bool = False) Users[source]
Fetches multiple users from the Amari API.
- Parameters:
guild_id (int) – The guild ID to fetch the users from.
user_ids (List[int]) – The IDs of the users you would like to fetch.
cache (bool) – Whether to use caching for this request.
- Returns:
The users object containing the fetched users.
- Return type: