Model Reference

This page will document every model that is returned, and used, by toppy.

Warning

These objects should not be manually created by users.

class toppy.models.Bot(**kwargs)

Model representing a top.gg bot

This also conforms with the discord user ABC. See: toppy.models.User

Attributes:
id: int

The bot’s ID

discriminator: str

The bot’s discriminator (prefixed with #)

username: str

the bot’s username

avatar: str

The bot’s avatar hash

user_avatar: Optional[str]

The bot’s custom avatar hash

default_avatar: str

The bot’s default avatar hash

prefix: str

The bot’s prefix

short_description: str

The bot’s short description on top.gg

long_description: str

The bot’s long description on top.gg

tags: py:List`[:class:`py:str]

A list of tags the bot uses on top.gg

website: Optional[str]

The bot’s website. Can be None.

support: Optional[str]

The bots support server URL. Can be None

github: Optional[str]

The bot’s github repo page URL. Can be None.

owners: py:List`[:class:`py:int]

A list of owner IDs that own this bot.

featured_guilds: py:List`[:class:`py:int]

A list of featured guild IDs that are used on the bot’s top.gg page

invite: str

The bot’s invite URL

Danger

This URL is not always a discord.com URL. If you are making requests to it, just be aware.

approved_at: datetime.datetime

The datetime that this bot was approved at on top.gg

Note

This can sometimes fail to resolve the given timestamp, and defaults to datetime.datetime.min.

certified: bool

Boolean indicating if this bot is certified on top.gg

vanity_uri: Optional[str]

This bot’s vanity endpoint on top.gg

all_time_votes: int

The total number of votes this bot received the entire time it has been on top.gg

monthly_votes: int

The total number of votes the bot got this month

donations_guild: Optional[py:int]

The server ID for donations using donatebot

user(state=None) Optional[User]

Gets the current discord user object from the top.gg user object.

state can be the bot/client instance, or anything with a get_user method.

class toppy.models.User(**kwargs)

Model representing a top.gg user’s account.

This class conforms to the discord.User ABC.

Warning

For some reason, top.gg just randomly omits fields that it shouldn’t according to their docs. As such, any or all fields here may be None.

property socials: Socials

An object containing the user’s social links.

property id: int

The user’s user ID.

property name: str

The user’s username.

property discriminator: str

The user’s #0000 discriminator

property avatar_url: str

This returns the user’s resolved avatar URL.

If the user doesn’t have an avatar, this will return their default one.

property bio: str

The user’s bio section on top.gg

property banner_url: str

The user’s banner URL on their top.gg profile

property colour: Colour

The user’s preferred navigation colour.

There is an alias for this under toppy.models.User.color

Returns

discord.Colour - the resolved colour

Return type

discord.Colour

property color: Colour

Alias for toppy.models.User.colour

user(state=None) Optional[User]

Gets the current discord user object from the top.gg user object.

state can be the bot/client instance, or anything with a get_user method.

Return type

Optional[discord.User]

class toppy.models.SimpleUser(**kwargs)

A model representing the “simple user” object returned by /bots/{id}/votes.

Attributes:
id: int

The user’s ID

discriminator: str

The user’s discriminator (prefixed with #)

username: str

the user’s username

avatar: Optional[str]

The user’s avatar URL

class toppy.models.BotStats(**kwargs)

Model representing 3 fields from /bot/{id}/stats

class toppy.models.BotSearchResults(*results: Bot, limit: int, offset: int)

A container for search results.

Attributes:
results: py:tuple`[:class:`toppy.models.Bot]

A tuple containing every found bot

limit: int

The limit used

offset: int

The offset used

count: int

The total number of bots found

total: int

An alias for count