Discovery¶
The following section documents everything related to Discovery.
Discovery is a feature on Stoat, that allows users to advertise their servers.
Clients¶
DiscoveryClient¶
- async bots
- async fetch_build_id
- async search_bots
- async search_servers
- async search_themes
- async servers
- async themes
- async use_latest_build_id
- class stoat.DiscoveryClient(*, adapter=None, base_url=None, state, user_agent='')[source]¶
Represents a client that sends requests to Discover.
- Parameters:
adapter (Optional[Union[MaybeAwaitableFunc[[
DiscoveryClient],HTTPAdapter],HTTPAdapter]]) – The adapter to use when making HTTP requests.base_url (Optional[
str]) – The base Discover API URL.state (
State) – The state.user_agent (
str) – The HTTP user agent to use when making requests.
- await fetch_build_id()[source]¶
This function is a coroutine.
Retrieves latest discover client build ID.
Note
This always retrieves only from official Discover instance.
- Raises:
DiscoverError– Fetching the main page failed.InvalidData– If library is unable look up build ID.
- Returns:
The build ID.
- Return type:
- await use_latest_build_id()[source]¶
This function is a coroutine.
Retrieves latest discover client build ID and uses it.
This follows same exceptions and notes as
fetch_build_id().- Returns:
The build ID.
- Return type:
- await servers()[source]¶
This function is a coroutine.
Retrieves servers on a main page.
- Raises:
DiscoverError – Getting the servers failed.
- Returns:
The servers page.
- Return type:
- await bots()[source]¶
This function is a coroutine.
Retrieves bots on a main page.
- Raises:
DiscoverError – Getting the bots failed.
- Returns:
The bots page.
- Return type:
- await themes()[source]¶
This function is a coroutine.
Retrieves themes on a main page.
- Raises:
DiscoverableError – Getting the themes failed.
- Returns:
The themes page.
- Return type:
- await search_servers(query)[source]¶
This function is a coroutine.
Searches for servers.
- Parameters:
query (
str) – The query to search for.- Raises:
DiscoverError – Searching failed.
- Returns:
The search results.
- Return type:
- await search_bots(query)[source]¶
This function is a coroutine.
Searches for bots.
- Parameters:
query (
str) – The query to search for.- Raises:
DiscoverError – Searching failed.
- Returns:
The search results.
- Return type:
Models¶
DiscoverableServer¶
- class stoat.DiscoverableServer(*, state, id, name, description, internal_icon, internal_banner, raw_flags, tags, member_count, activity)[source]¶
Represents a server on Stoat Discovery. The ID is an invite code.
This inherits from
BaseServer.- internal_icon¶
The stateless server icon.
- Type:
Optional[
StatelessAsset]
- internal_banner¶
The stateless server banner.
- Type:
Optional[
StatelessAsset]
- activity¶
The server’s activity.
- Type:
DiscoverableServersPage¶
DiscoverableBot¶
- class stoat.DiscoverableBot(*, state, id, name, internal_avatar, internal_profile, tags, server_count, usage)[source]¶
Represents a bot on Stoat Discovery.
This inherits from
BaseBot.- internal_avatar¶
The stateless bot’s avatar.
- Type:
Optional[
StatelessAsset]
- internal_profile¶
The stateless bot’s profile.
- Type:
Optional[
StatelessUserProfile]
DiscoverableBotsPage¶
DiscoverableTheme¶
- async apply
- class stoat.DiscoverableTheme(state, *, name, description, creator, slug, tags, overrides, version, custom_css)[source]¶
Represents a theme on Stoat Discovery.
Themes are currently only available in Discover.
- overrides¶
The theme overrides in format
{css_class: css_color}.- Type:
Dict[
ReviteThemeVariable,str]
- await apply(*, base_theme=UNDEFINED)[source]¶
This function is a coroutine.
Applies the theme to current user account.
- Parameters:
base_theme (UndefinedOr[
ReviteBaseTheme]) – The base theme to use, when applying theme.
DiscoverableThemesPage¶
ServerSearchResult¶
- class stoat.ServerSearchResult(*, query, count, servers, related_tags)[source]¶
The server search result object.
- servers¶
The listed servers.
- Type:
List[
DiscoverableServer]
All of tags that listed servers have.
- Type:
List[
str]