API

class cookie.CookieAPI(api_key=None, httpx_client=None)

A class to interact with the Cookie API.

Parameters:
  • api_key (str | None) – The API key to use. If no key is provided, COOKIE_KEY is loaded from the environment.

  • httpx_client (Client | None) – An existing httpx client to use.

get_guild_stats(guild_id, days=14)

Get the history of the guild member count for the provided number of days.

Parameters:
  • guild_id (int) – The guild’s ID

  • days (int) – The number of days. Defaults to 14.

Raises:

NoGuildAccess: – You don’t have access to that guild.

Return type:

GuildStats

get_user_stats(user_id)

Get the user’s level stats.

Parameters:

user_id (int) – The user’s ID.

Raises:

NotFound: – The user was not found.

Return type:

UserStats

get_member_stats(user_id, guild_id)

Get the member’s level stats.

Parameters:
  • user_id (int) – The user’s ID.

  • guild_id (int) – The guild’s ID.

Raises:

NotFound: – The user was not found.

Return type:

MemberStats

get_member_activity(user_id, guild_id, days=14)

Get the member’s activity for the provided number of days.

Parameters:
  • user_id (int) – The user’s ID.

  • guild_id (int) – The guild’s ID.

  • days (int) – The number of days. Defaults to 14.

Raises:

NotFound: – The user was not found.

Return type:

MemberActivity

get_guild_activity(guild_id, days=14)

Get the guild’s activity for the provided number of days.

Parameters:
  • guild_id (int) – The guild’s ID.

  • days (int) – The number of days. Defaults to 14.

Raises:

NoGuildAccess: – You don’t have access to that guild.

Return type:

GuildActivity

get_guild_image(guild_id, days=14)

Get the guild’s activity image for the provided number of days.

Parameters:
  • guild_id (int) – The guild’s ID.

  • days (int) – The number of days. Defaults to 14.

Raises:

NoGuildAccess: – You don’t have access to that guild.

Return type:

bytes

get_member_image(user_id, guild_id, days=14)

Get the member’s activity image for the provided number of days.

Parameters:
  • user_id (int) – The user’s ID.

  • guild_id (int) – The guild’s ID.

  • days (int) – The number of days. Defaults to 14.

Raises:

NotFound: – The user was not found.

Return type:

bytes