Settings¶
The following section documents everything related to user settings.
Models¶
UserSettings¶
- def as_dict
- async edit
- def get
- def locally_update
- class stoat.UserSettings(*, data, state, mocked, partial)[source]¶
Represents Stoat user settings.
- mocked¶
Whether user settings are mocked. Mocked user settings are created by library itself, if not logged in, or in HTTP-only mode.
- Type:
- partial¶
Whether user settings are partial. This is set to
Truewhen used viaUserSettingsUpdateEvent.partial.- Type:
- 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
androiduser setting JSON string is corrupted.- Type:
- property revite[source]¶
The Revite user settings.
- Raises:
Exception – If user settings are corrupted.
- Type:
- property jolt[source]¶
The Jolt user settings.
- Raises:
Exception – If user settings are corrupted.
- Type:
- await edit(partial, edited_at=None, *, http_overrides=None)[source]¶
This function is a coroutine.
Edits the current user settings.
Fires
UserSettingsUpdateEventfor 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.http_overrides (Optional[
HTTPOverrideOptions]) – The HTTP request overrides.
- Raises:
Unauthorized– Possible values fortype:Value
Reason
InvalidSessionThe current bot/user token is invalid.
InternalServerError– Possible values fortype:Value
Reason
Populated attributes
DatabaseErrorSomething went wrong during querying database.
AndroidUserSettings¶
- async edit
- def locally_update
- def payload_for
- class stoat.AndroidUserSettings(parent, /)[source]¶
Represents Android user settings.
- parent¶
The parent.
- Type:
- 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.
- 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 beNoneto remove it from internal object.font (UndefinedOr[Optional[
AndroidFont]]) – The new font. Could beNoneto remove it from internal object.color_overrides (UndefinedOr[Optional[Dict[
str,int]]]) – The new color overrides. PassingNonedenotescolourOverridesremoval in internal object.reply_style (UndefinedOr[Optional[
AndroidMessageReplyStyle]]) – The new message reply style. PassingNonedenotesmessageReplyStyleremoval in internal object.avatar_radius (UndefinedOr[Optional[Union[
AndroidProfilePictureShape,int]]]) – The new avatar radius. PassingNonedenotesavatarRadiusremoval in internal object.initial_special_embed_settings_payload (UndefinedOr[Optional[raw.AndroidUserSettingsSpecialEmbedSettings]]) – The initial payload. Could be
Noneto 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
UserSettingsUpdateEventfor the current user.- Parameters:
http_overrides (Optional[
HTTPOverrideOptions]) – The HTTP request overrides.edited_at (Optional[Union[
datetime,int]]) – External parameter to pass inHTTPClient.edit_user_settings().theme (UndefinedOr[Optional[
AndroidTheme]]) – The new theme. Could beNoneto remove it from internal object.font (UndefinedOr[Optional[
AndroidFont]]) – The new font. Could beNoneto remove it from internal object.color_overrides (UndefinedOr[Optional[Dict[
str,int]]]) – The new color overrides. PassingNonedenotescolourOverridesremoval in internal object.reply_style (UndefinedOr[Optional[
AndroidMessageReplyStyle]]) – The new message reply style. PassingNonedenotesmessageReplyStyleremoval in internal object.avatar_radius (UndefinedOr[Optional[Union[
AndroidProfilePictureShape,int]]]) – The new avatar radius. PassingNonedenotesavatarRadiusremoval in internal object.initial_special_embed_settings_payload (UndefinedOr[Optional[raw.AndroidUserSettingsSpecialEmbedSettings]]) – The initial payload. Could be
Noneto 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:
Unauthorized– Possible values fortype:Value
Reason
InvalidSessionThe current bot/user token is invalid.
InternalServerError– Possible values fortype:Value
Reason
Populated attributes
DatabaseErrorSomething went wrong during querying database.
ReviteNotificationOptions¶
- 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¶
- async edit
- def get_base_theme
- def get_emoji_pack
- def get_font
- def get_language
- def get_monofont
- def get_notification_options
- def get_theme_overrides
- def is_ligatures_enabled
- def is_seasonal
- def is_transparent
- def locally_update
- def payload_for
- class stoat.ReviteUserSettings(parent, /)[source]¶
Represents Revite user settings.
- parent¶
The raw user settings.
- Type:
- 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]
- ligatures¶
Whether to combine characters together or not. For example,
->turns into an arrow if this property isTrue. Applicable only for supported fonts (such asReviteFont.inter).- Type:
Optional[
bool]
- property language[source]¶
The current language. Defaults to
Language.english_simplifiedif language is undefined.- Type:
- get_notification_options()[source]¶
Optional[
ReviteNotificationOptions]: The notification options.
- get_emoji_pack()[source]¶
Optional[
ReviteEmojiPack]: Gets the current emoji pack.
- is_seasonal()[source]¶
bool: Whether to display effects in the home tab during holiday seasons or not.
- is_ligatures_enabled()[source]¶
bool: Whether to combine characters together or not. For example,->turns into an arrow if this property isTrue.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.darkif base theme is undefined.- Type:
- get_font()[source]¶
Optional[
ReviteFont]: The current Revite font.
- property font[source]¶
The current Revite font. Defaults to
ReviteFont.open_sansif font is undefined.- Type:
- get_monofont()[source]¶
Optional[
ReviteMonoFont]: The current Revite monospace font.
- property monofont[source]¶
The current Revite monospace font. Defaults to
ReviteMonoFont.fira_codeif monofont is undefined.- Type:
- 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
changelogpayload.last_viewed_changelog_entry (UndefinedOr[Union[
ReviteChangelogEntry,int]]) – The last viewed changelog entry.initial_locale_payload (UndefinedOr[raw.ReviteLocaleOptions]) – The initial
localepayload.language (UndefinedOr[
Language]) – The language.initial_notifications_payload (UndefinedOr[raw.ReviteNotificationOptions]) – The initial
notificationspayload.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 toTrue.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 toTrue.initial_ordering_payload (UndefinedOr[raw.ReviteOrdering]) – The initial
orderingpayload.ordering (UndefinedOr[List[ULIDOr[
BaseServer]]]) – The servers tab order.initial_appearance_payload (UndefinedOr[raw.ReviteAppearanceSettings]) – The initial
appearancepayload.emoji_pack (UndefinedOr[Optional[
ReviteEmojiPack]]) – The new emoji pack to use. PassingNonedenotesappearance.appearance:emojiremoval in internal object.seasonal (UndefinedOr[Optional[
bool]]) – To display effects in the home tab during holiday seasons or not. PassingNonedenotesappearance.appearance:seasonalremoval in internal object.transparent (UndefinedOr[Optional[
bool]]) – To enable transparency effects throughout the app or not. PassingNonedenotesappearance.appearance:transparencyremoval in internal object.initial_theme_payload (UndefinedOr[raw.ReviteThemeSettings]) – The initial
themepayload.ligatures (UndefinedOr[Optional[
bool]]) – To combine characters together or not. More details inReviteUserSettings.ligatures. PassingNonedenotestheme.appearance:ligaturesremoval in internal object.base_theme (UndefinedOr[Optional[
ReviteBaseTheme]]) – The base theme to use. PassingNonedenotestheme.appearance:theme:baseremoval in internal object.custom_css (UndefinedOr[Optional[
str]]) – The CSS string. PassingNonedenotestheme.appearance:theme:cssremoval in internal object.font (UndefinedOr[Optional[
ReviteFont]]) – The font to use across the app. PassingNonedenotestheme.appearance:theme:fontremoval in internal object.monofont (UndefinedOr[Optional[
ReviteMonoFont]]) – The monospace font to use in codeblocks. PassingNonedenotestheme.appearance:theme:monoFontremoval in internal object.overrides (UndefinedOr[Optional[Dict[
ReviteThemeVariable,str]]]) – The theme overrides. PassingNonedenotestheme.appearance:theme:overridesremoval 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
UserSettingsUpdateEventfor the current user.- Parameters:
http_overrides (Optional[
HTTPOverrideOptions]) – The HTTP request overrides.edited_at (Optional[Union[
datetime,int]]) – External parameter to pass inHTTPClient.edit_user_settings().initial_changelog_payload (UndefinedOr[raw.ReviteChangelog]) – The initial
changelogpayload.last_viewed_changelog_entry (UndefinedOr[Union[
ReviteChangelogEntry,int]]) – The last viewed changelog entry.initial_locale_payload (UndefinedOr[raw.ReviteLocaleOptions]) – The initial
localepayload.language (UndefinedOr[
Language]) – The language.initial_notifications_payload (UndefinedOr[raw.ReviteNotificationOptions]) – The initial
notificationspayload.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 toTrue.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 toTrue.initial_ordering_payload (UndefinedOr[raw.ReviteOrdering]) – The initial
orderingpayload.ordering (UndefinedOr[List[ULIDOr[
BaseServer]]]) – The servers tab order.initial_appearance_payload (UndefinedOr[raw.ReviteAppearanceSettings]) – The initial
appearancepayload.emoji_pack (UndefinedOr[Optional[
ReviteEmojiPack]]) – The new emoji pack to use. PassingNonedenotesappearance.appearance:emojiremoval in internal object.seasonal (UndefinedOr[Optional[
bool]]) – To display effects in the home tab during holiday seasons or not. PassingNonedenotesappearance.appearance:seasonalremoval in internal object.transparent (UndefinedOr[Optional[
bool]]) – To enable transparency effects throughout the app or not. PassingNonedenotesappearance.appearance:transparencyremoval in internal object.initial_theme_payload (UndefinedOr[raw.ReviteThemeSettings]) – The initial
themepayload.ligatures (UndefinedOr[Optional[
bool]]) – To combine characters together or not. More details inReviteUserSettings.ligatures. PassingNonedenotestheme.appearance:ligaturesremoval in internal object.base_theme (UndefinedOr[Optional[
ReviteBaseTheme]]) – The base theme to use. PassingNonedenotestheme.appearance:theme:baseremoval in internal object.custom_css (UndefinedOr[Optional[
str]]) – The CSS string. PassingNonedenotestheme.appearance:theme:cssremoval in internal object.font (UndefinedOr[Optional[
ReviteFont]]) – The font to use across the app. PassingNonedenotestheme.appearance:theme:fontremoval in internal object.monofont (UndefinedOr[Optional[
ReviteMonoFont]]) – The monospace font to use in codeblocks. PassingNonedenotestheme.appearance:theme:monoFontremoval in internal object.overrides (UndefinedOr[Optional[Dict[
ReviteThemeVariable,str]]]) – The theme overrides. PassingNonedenotestheme.appearance:theme:overridesremoval in internal object.
- Raises:
Unauthorized– Possible values fortype:Value
Reason
InvalidSessionThe current bot/user token is invalid.
InternalServerError– Possible values fortype:Value
Reason
Populated attributes
DatabaseErrorSomething went wrong during querying database.
JoltUserSettings¶
- async edit
- def is_compact_mode_enabled
- def is_low_data_mode_enabled
- def is_receive_typing_indicators
- def is_send_typing_indicators
- def locally_update
- def payload_for
- class stoat.JoltUserSettings(parent, /)[source]¶
Represents Jolt user settings.
- parent¶
The raw user settings.
- Type:
- 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_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
UserSettingsUpdateEventfor the current user.- Parameters:
http_overrides (Optional[
HTTPOverrideOptions]) – The HTTP request overrides.edited_at (Optional[Union[
datetime,int]]) – External parameter to pass inHTTPClient.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:
Unauthorized– Possible values fortype:Value
Reason
InvalidSessionThe current bot/user token is invalid.
InternalServerError– Possible values fortype:Value
Reason
Populated attributes
DatabaseErrorSomething went wrong during querying database.