Settings

The following section documents everything related to user settings.

Models

UserSettings

Methods
class stoat.UserSettings(*, data, state, mocked, partial)[source]

Represents Stoat user settings.

state

The state that manages current user settings.

Type:

State

data

The mapping of {key: (timestamp, value)}.

Type:

Dict[str, Tuple[int, str]]

mocked

Whether user settings are mocked. Mocked user settings are created by library itself, if not logged in, or in HTTP-only mode.

Type:

bool

partial

Whether user settings are partial. This is set to True when used via UserSettingsUpdateEvent.partial.

Type:

bool

as_dict()[source]

Dict[str, str]: The dictionary of {key -> value}.

locally_update(partial, /)[source]

Locally updates user settings with provided data.

Warning

This is called by library internally to keep settings up to date.

Parameters:

partial (UserSettings) – The data to update settings with.

property android[source]

The Android user settings.

Raises:

Exception – If android user setting JSON string is corrupted.

Type:

AndroidUserSettings

property revite[source]

The Revite user settings.

Raises:

Exception – If user settings are corrupted.

Type:

ReviteUserSettings

property jolt[source]

The Jolt user settings.

Raises:

Exception – If user settings are corrupted.

Type:

JoltUserSettings

get(key, default=None)[source]

Union[str, D]: Retrieve value for an user setting.

await edit(partial, edited_at=None, *, http_overrides=None)[source]

This function is a coroutine.

Edits the current user settings.

Fires UserSettingsUpdateEvent for the current user.

Note

This can only be used by non-bot accounts.

Parameters:
  • partial (Dict[str, str]) – The dict to merge into the current user settings.

  • edited_at (Optional[Union[datetime, int]]) – The revision.

  • http_overrides (Optional[HTTPOverrideOptions]) – The HTTP request overrides.

Raises:

AndroidUserSettings

class stoat.AndroidUserSettings(parent, /)[source]

Represents Android user settings.

parent

The parent.

Type:

UserSettings

locally_update(payload, /)[source]

Locally updates user settings with provided data.

Warning

This is called by library internally to keep settings up to date.

Parameters:

payload (raw.AndroidUserSettings) – The data to update settings with.

property theme[source]

The current theme.

Type:

AndroidTheme

property font[source]

The current font.

Type:

AndroidFont

property color_overrides[source]

The current theme color overrides.

Type:

Dict[str, int]

property reply_style[source]

The current theme.

Type:

AndroidMessageReplyStyle

property profile_picture_shape[source]

The current profile picture shape.

Type:

int

property embed_youtube[source]

Whether to render special YouTube embeds.

Type:

bool

property embed_apple_music[source]

Whether to render special Apple Music embeds.

Type:

bool

payload_for(*, initial_payload=UNDEFINED, theme=UNDEFINED, font=UNDEFINED, color_overrides=UNDEFINED, reply_style=UNDEFINED, avatar_radius=UNDEFINED, embed_youtube=UNDEFINED, embed_apple_music=UNDEFINED, initial_special_embed_settings_payload=UNDEFINED)[source]

Builds a payload for Android user settings. You must pass it as JSON string to HTTPClient.edit_user_settings(), like so:

payload = settings.payload_for(theme=AndroidTheme.material_you)
await http.edit_user_settings(android=json.dumps(payload))
Parameters:
  • initial_payload (UndefinedOr[raw.AndroidUserSettings]) – The initial payload.

  • theme (UndefinedOr[Optional[AndroidTheme]]) – The new theme. Could be None to remove it from internal object.

  • font (UndefinedOr[Optional[AndroidFont]]) – The new font. Could be None to remove it from internal object.

  • color_overrides (UndefinedOr[Optional[Dict[str, int]]]) – The new color overrides. Passing None denotes colourOverrides removal in internal object.

  • reply_style (UndefinedOr[Optional[AndroidMessageReplyStyle]]) – The new message reply style. Passing None denotes messageReplyStyle removal in internal object.

  • avatar_radius (UndefinedOr[Optional[Union[AndroidProfilePictureShape, int]]]) – The new avatar radius. Passing None denotes avatarRadius removal in internal object.

  • initial_special_embed_settings_payload (UndefinedOr[Optional[raw.AndroidUserSettingsSpecialEmbedSettings]]) – The initial payload. Could be None to remove it from internal object.

  • embed_youtube (UndefinedOr[bool]) – Whether to render special YouTube embeds.

  • embed_apple_music (UndefinedOr[bool]) – Whether to render special Apple Music embeds.

await edit(*, http_overrides=None, edited_at=None, theme=UNDEFINED, font=UNDEFINED, color_overrides=UNDEFINED, reply_style=UNDEFINED, avatar_radius=UNDEFINED, embed_youtube=UNDEFINED, embed_apple_music=UNDEFINED, initial_special_embed_settings_payload=UNDEFINED)[source]

This function is a coroutine.

Edits the Android user settings.

Fires UserSettingsUpdateEvent for the current user.

Parameters:
  • http_overrides (Optional[HTTPOverrideOptions]) – The HTTP request overrides.

  • edited_at (Optional[Union[datetime, int]]) – External parameter to pass in HTTPClient.edit_user_settings().

  • theme (UndefinedOr[Optional[AndroidTheme]]) – The new theme. Could be None to remove it from internal object.

  • font (UndefinedOr[Optional[AndroidFont]]) – The new font. Could be None to remove it from internal object.

  • color_overrides (UndefinedOr[Optional[Dict[str, int]]]) – The new color overrides. Passing None denotes colourOverrides removal in internal object.

  • reply_style (UndefinedOr[Optional[AndroidMessageReplyStyle]]) – The new message reply style. Passing None denotes messageReplyStyle removal in internal object.

  • avatar_radius (UndefinedOr[Optional[Union[AndroidProfilePictureShape, int]]]) – The new avatar radius. Passing None denotes avatarRadius removal in internal object.

  • initial_special_embed_settings_payload (UndefinedOr[Optional[raw.AndroidUserSettingsSpecialEmbedSettings]]) – The initial payload. Could be None to remove it from internal object.

  • embed_youtube (UndefinedOr[bool]) – Whether to render special YouTube embeds.

  • embed_apple_music (UndefinedOr[bool]) – Whether to render special Apple Music embeds.

Raises:

ReviteNotificationOptions

Attributes
class stoat.ReviteNotificationOptions(data)[source]

Represents Revite notification options.

servers

The servers.

Type:

Dict[str, ReviteNotificationState]

channels

The channels.

Type:

Dict[str, ReviteNotificationState]

ReviteThemeVariable

stoat.ReviteThemeVariable

alias of raw.ReviteThemeVariable

ReviteUserSettings

class stoat.ReviteUserSettings(parent, /)[source]

Represents Revite user settings.

parent

The raw user settings.

Type:

UserSettings

last_viewed_changelog_entry

The last viewed changelog entry.

Type:

Optional[ReviteChangelogEntry]

seasonal

Whether to display effects in the home tab during holiday seasons or not.

Type:

Optional[bool]

transparent

Whether to enable transparency effects throughout the app or not.

Type:

Optional[bool]

ligatures

Whether to combine characters together or not. For example, -> turns into an arrow if this property is True. Applicable only for supported fonts (such as ReviteFont.inter).

Type:

Optional[bool]

get_language()[source]

Optional[Language]: The current language.

property language[source]

The current language. Defaults to Language.english_simplified if language is undefined.

Type:

Language

get_notification_options()[source]

Optional[ReviteNotificationOptions]: The notification options.

property notification_options[source]

The notification options.

Type:

ReviteNotificationOptions

property ordering[source]

The server ordering.

Type:

List[str]

get_emoji_pack()[source]

Optional[ReviteEmojiPack]: Gets the current emoji pack.

property emoji_pack[source]

The current emoji pack.

Type:

ReviteEmojiPack

is_seasonal()[source]

bool: Whether to display effects in the home tab during holiday seasons or not.

is_transparent()[source]

Whether to enable transparency effects throughout the app or not.

is_ligatures_enabled()[source]

bool: Whether to combine characters together or not. For example, -> turns into an arrow if this property is True.

Applicable only for supported fonts (such as ReviteFont.inter).

get_base_theme()[source]

Optional[ReviteBaseTheme]: The current base theme.

property base_theme[source]

The current base theme. Defaults to ReviteBaseTheme.dark if base theme is undefined.

Type:

ReviteBaseTheme

property custom_css[source]

The custom CSS string.

Type:

Optional[str]

get_font()[source]

Optional[ReviteFont]: The current Revite font.

property font[source]

The current Revite font. Defaults to ReviteFont.open_sans if font is undefined.

Type:

ReviteFont

get_monofont()[source]

Optional[ReviteMonoFont]: The current Revite monospace font.

property monofont[source]

The current Revite monospace font. Defaults to ReviteMonoFont.fira_code if monofont is undefined.

Type:

ReviteMonoFont

get_theme_overrides()[source]

Optional[Dict[ReviteThemeVariable, str]]: The theme overrides.

property theme_overrides[source]

The theme overrides.

Type:

Dict[ReviteThemeVariable, str]

locally_update(payload, /, *, full)[source]

Locally updates user settings with provided data.

Warning

This is called by library internally to keep settings up to date.

Parameters:
  • payload (UserSettings) – The data to update settings with.

  • full (bool) – Whether the payload is full.

payload_for(*, initial_changelog_payload=UNDEFINED, last_viewed_changelog_entry=UNDEFINED, initial_locale_payload=UNDEFINED, language=UNDEFINED, initial_notifications_payload=UNDEFINED, server_notifications=UNDEFINED, merge_server_notifications=True, channel_notifications=UNDEFINED, merge_channel_notifications=True, initial_ordering_payload=UNDEFINED, ordering=UNDEFINED, initial_appearance_payload=UNDEFINED, emoji_pack=UNDEFINED, seasonal=UNDEFINED, transparent=UNDEFINED, initial_theme_payload=UNDEFINED, ligatures=UNDEFINED, base_theme=UNDEFINED, custom_css=UNDEFINED, font=UNDEFINED, monofont=UNDEFINED, overrides=UNDEFINED)[source]

Builds a payload for Revite user settings. You must pass it as first argument to HTTPClient.edit_user_settings(), like so:

payload = settings.payload_for(language=Language.russian)
await http.edit_user_settings(payload)
Parameters:
  • initial_changelog_payload (UndefinedOr[raw.ReviteChangelog]) – The initial changelog payload.

  • last_viewed_changelog_entry (UndefinedOr[Union[ReviteChangelogEntry, int]]) – The last viewed changelog entry.

  • initial_locale_payload (UndefinedOr[raw.ReviteLocaleOptions]) – The initial locale payload.

  • language (UndefinedOr[Language]) – The language.

  • initial_notifications_payload (UndefinedOr[raw.ReviteNotificationOptions]) – The initial notifications payload.

  • server_notifications (UndefinedOr[Dict[ULIDOr[BaseServer], ReviteNotificationState]]) – The notification options for servers.

  • merge_server_notifications (bool) – Whether to merge new servers notifications options into existing ones. Defaults to True.

  • channel_notifications (UndefinedOr[Dict[ULIDOr[Channel], ReviteNotificationState]]) – The notification options for channels.

  • merge_channel_notifications (bool) – Whether to merge new channels notifications options into existing ones. Defaults to True.

  • initial_ordering_payload (UndefinedOr[raw.ReviteOrdering]) – The initial ordering payload.

  • ordering (UndefinedOr[List[ULIDOr[BaseServer]]]) – The servers tab order.

  • initial_appearance_payload (UndefinedOr[raw.ReviteAppearanceSettings]) – The initial appearance payload.

  • emoji_pack (UndefinedOr[Optional[ReviteEmojiPack]]) – The new emoji pack to use. Passing None denotes appearance.appearance:emoji removal in internal object.

  • seasonal (UndefinedOr[Optional[bool]]) – To display effects in the home tab during holiday seasons or not. Passing None denotes appearance.appearance:seasonal removal in internal object.

  • transparent (UndefinedOr[Optional[bool]]) – To enable transparency effects throughout the app or not. Passing None denotes appearance.appearance:transparency removal in internal object.

  • initial_theme_payload (UndefinedOr[raw.ReviteThemeSettings]) – The initial theme payload.

  • ligatures (UndefinedOr[Optional[bool]]) – To combine characters together or not. More details in ReviteUserSettings.ligatures. Passing None denotes theme.appearance:ligatures removal in internal object.

  • base_theme (UndefinedOr[Optional[ReviteBaseTheme]]) – The base theme to use. Passing None denotes theme.appearance:theme:base removal in internal object.

  • custom_css (UndefinedOr[Optional[str]]) – The CSS string. Passing None denotes theme.appearance:theme:css removal in internal object.

  • font (UndefinedOr[Optional[ReviteFont]]) – The font to use across the app. Passing None denotes theme.appearance:theme:font removal in internal object.

  • monofont (UndefinedOr[Optional[ReviteMonoFont]]) – The monospace font to use in codeblocks. Passing None denotes theme.appearance:theme:monoFont removal in internal object.

  • overrides (UndefinedOr[Optional[Dict[ReviteThemeVariable, str]]]) – The theme overrides. Passing None denotes theme.appearance:theme:overrides removal in internal object.

Returns:

The payload that must to be passed in HTTPClient.edit_user_settings().

Return type:

Dict[str, Any]

await edit(*, http_overrides=None, edited_at=None, initial_changelog_payload=UNDEFINED, last_viewed_changelog_entry=UNDEFINED, initial_locale_payload=UNDEFINED, language=UNDEFINED, initial_notifications_payload=UNDEFINED, server_notifications=UNDEFINED, merge_server_notifications=True, channel_notifications=UNDEFINED, merge_channel_notifications=True, initial_ordering_payload=UNDEFINED, ordering=UNDEFINED, initial_appearance_payload=UNDEFINED, emoji_pack=UNDEFINED, seasonal=UNDEFINED, transparent=UNDEFINED, initial_theme_payload=UNDEFINED, ligatures=UNDEFINED, base_theme=UNDEFINED, custom_css=UNDEFINED, font=UNDEFINED, monofont=UNDEFINED, overrides=UNDEFINED)[source]

This function is a coroutine.

Edits the Revite user settings.

Fires UserSettingsUpdateEvent for the current user.

Parameters:
  • http_overrides (Optional[HTTPOverrideOptions]) – The HTTP request overrides.

  • edited_at (Optional[Union[datetime, int]]) – External parameter to pass in HTTPClient.edit_user_settings().

  • initial_changelog_payload (UndefinedOr[raw.ReviteChangelog]) – The initial changelog payload.

  • last_viewed_changelog_entry (UndefinedOr[Union[ReviteChangelogEntry, int]]) – The last viewed changelog entry.

  • initial_locale_payload (UndefinedOr[raw.ReviteLocaleOptions]) – The initial locale payload.

  • language (UndefinedOr[Language]) – The language.

  • initial_notifications_payload (UndefinedOr[raw.ReviteNotificationOptions]) – The initial notifications payload.

  • server_notifications (UndefinedOr[Dict[ULIDOr[BaseServer], ReviteNotificationState]]) – The notification options for servers.

  • merge_server_notifications (bool) – Whether to merge new servers notifications options into existing ones. Defaults to True.

  • channel_notifications (UndefinedOr[Dict[ULIDOr[Channel], ReviteNotificationState]]) – The notification options for channels.

  • merge_channel_notifications (bool) – Whether to merge new channels notifications options into existing ones. Defaults to True.

  • initial_ordering_payload (UndefinedOr[raw.ReviteOrdering]) – The initial ordering payload.

  • ordering (UndefinedOr[List[ULIDOr[BaseServer]]]) – The servers tab order.

  • initial_appearance_payload (UndefinedOr[raw.ReviteAppearanceSettings]) – The initial appearance payload.

  • emoji_pack (UndefinedOr[Optional[ReviteEmojiPack]]) – The new emoji pack to use. Passing None denotes appearance.appearance:emoji removal in internal object.

  • seasonal (UndefinedOr[Optional[bool]]) – To display effects in the home tab during holiday seasons or not. Passing None denotes appearance.appearance:seasonal removal in internal object.

  • transparent (UndefinedOr[Optional[bool]]) – To enable transparency effects throughout the app or not. Passing None denotes appearance.appearance:transparency removal in internal object.

  • initial_theme_payload (UndefinedOr[raw.ReviteThemeSettings]) – The initial theme payload.

  • ligatures (UndefinedOr[Optional[bool]]) – To combine characters together or not. More details in ReviteUserSettings.ligatures. Passing None denotes theme.appearance:ligatures removal in internal object.

  • base_theme (UndefinedOr[Optional[ReviteBaseTheme]]) – The base theme to use. Passing None denotes theme.appearance:theme:base removal in internal object.

  • custom_css (UndefinedOr[Optional[str]]) – The CSS string. Passing None denotes theme.appearance:theme:css removal in internal object.

  • font (UndefinedOr[Optional[ReviteFont]]) – The font to use across the app. Passing None denotes theme.appearance:theme:font removal in internal object.

  • monofont (UndefinedOr[Optional[ReviteMonoFont]]) – The monospace font to use in codeblocks. Passing None denotes theme.appearance:theme:monoFont removal in internal object.

  • overrides (UndefinedOr[Optional[Dict[ReviteThemeVariable, str]]]) – The theme overrides. Passing None denotes theme.appearance:theme:overrides removal in internal object.

Raises:

JoltUserSettings

class stoat.JoltUserSettings(parent, /)[source]

Represents Jolt user settings.

parent

The raw user settings.

Type:

UserSettings

low_data_mode

Whether Jolt should NOT load images and fetch users if not found in cache.

Type:

Optional[bool]

compact_mode

Whether to hide user profile pictures in chats. Easier on the eyes.

Type:

Optional[bool]

send_typing_indicators

Whether to send typing indicators when writing messages.

Type:

Optional[bool]

receive_typing_indicators

Whether to show typing indicators (‘<user> is typing…’).

Type:

Optional[bool]

is_low_data_mode_enabled()[source]

bool: Whether Jolt should NOT load images and fetch users if not found in cache.

is_compact_mode_enabled()[source]

bool: Whether to hide user profile pictures in chats. Easier on the eyes.

is_send_typing_indicators()[source]

bool: Whether to send typing indicators when writing messages.

is_receive_typing_indicators()[source]

bool: Whether to show typing indicators (‘<user> is typing…’).

locally_update(payload, /, *, full)[source]

Locally updates user settings with provided data.

Warning

This is called by library internally to keep settings up to date.

Parameters:
  • payload (UserSettings) – The data to update settings with.

  • full (bool) – Whether the payload is full.

payload_for(*, low_data_mode=UNDEFINED, compact_mode=UNDEFINED, send_typing_indicators=UNDEFINED, receive_typing_indicators=UNDEFINED)[source]

Builds a payload for Jolt user settings. You must pass it as first argument to HTTPClient.edit_user_settings(), like so:

payload = settings.payload_for(low_data_mode=True)
await http.edit_user_settings(payload)
Parameters:
  • low_data_mode (UndefinedOr[bool]) – Whether Jolt should NOT load images and fetch users if not found in cache.

  • compact_mode (UndefinedOr[bool]) – Whether to hide user profile pictures in chats. Easier on the eyes.

  • send_typing_indicators (UndefinedOr[bool]) – Whether to send typing indicators when writing messages.

  • receive_typing_indicators (UndefinedOr[bool]) – Whether to show typing indicators (‘<user> is typing…’).

Returns:

The payload that must to be passed in HTTPClient.edit_user_settings().

Return type:

Dict[str, Any]

await edit(*, http_overrides=None, edited_at=None, low_data_mode=UNDEFINED, compact_mode=UNDEFINED, send_typing_indicators=UNDEFINED, receive_typing_indicators=UNDEFINED)[source]

This function is a coroutine.

Edits the Jolt user settings.

Fires UserSettingsUpdateEvent for the current user.

Parameters:
  • http_overrides (Optional[HTTPOverrideOptions]) – The HTTP request overrides.

  • edited_at (Optional[Union[datetime, int]]) – External parameter to pass in HTTPClient.edit_user_settings().

  • low_data_mode (UndefinedOr[bool]) – Whether Jolt should NOT load images and fetch users if not found in cache.

  • compact_mode (UndefinedOr[bool]) – Whether to hide user profile pictures in chats. Easier on the eyes.

  • send_typing_indicators (UndefinedOr[bool]) – Whether to send typing indicators when writing messages.

  • receive_typing_indicators (UndefinedOr[bool]) – Whether to show typing indicators (‘<user> is typing…’).

Raises: