From 6ad3f755a7633aaae8adf50c6325094788cd0fe9 Mon Sep 17 00:00:00 2001 From: dolfies Date: Wed, 23 Aug 2023 15:38:19 +0300 Subject: [PATCH] Add Application.quarantined attribute --- discord/application.py | 20 +++++++++++++++++++- discord/types/application.py | 3 ++- 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/discord/application.py b/discord/application.py index 3a8d4f58f..5898a2832 100644 --- a/discord/application.py +++ b/discord/application.py @@ -715,6 +715,16 @@ class ApplicationBot(User): """ return self.application.disabled + @property + def quarantined(self) -> bool: + """:class:`bool`: Whether the bot is quarantined by Discord. + + Quarantined bots cannot join more guilds or start new direct messages. + + .. versionadded:: 2.1 + """ + return self.application.quarantined + @property def bio(self) -> Optional[str]: """Optional[:class:`str`]: Returns the bot's 'about me' section.""" @@ -2281,6 +2291,12 @@ class Application(PartialApplication): disabled: :class:`bool` Whether the bot attached to this application is disabled by Discord. + .. versionadded:: 2.1 + quarantined: :class:`bool` + Whether the bot attached to this application is quarantined by Discord. + + Quarantined bots cannot join more guilds or start new direct messages. + .. versionadded:: 2.1 interactions_endpoint_url: Optional[:class:`str`] The URL interactions will be sent to, if set. @@ -2310,6 +2326,7 @@ class Application(PartialApplication): 'role_connections_verification_url', 'bot', 'disabled', + 'quarantined', 'verification_state', 'store_application_state', 'rpc_application_state', @@ -2328,7 +2345,8 @@ class Application(PartialApplication): def _update(self, data: ApplicationPayload) -> None: super()._update(data) - self.disabled = data.get('bot_disabled', False) + self.disabled: bool = data.get('bot_disabled', False) + self.quarantined: bool = data.get('bot_quarantined', False) self.redirect_uris: List[str] = data.get('redirect_uris', []) self.interactions_endpoint_url: Optional[str] = data.get('interactions_endpoint_url') self.role_connections_verification_url: Optional[str] = data.get('role_connections_verification_url') diff --git a/discord/types/application.py b/discord/types/application.py index 754fb14ee..e58e906b9 100644 --- a/discord/types/application.py +++ b/discord/types/application.py @@ -84,7 +84,6 @@ class PartialApplication(_BaseApplication): max_participants: NotRequired[Optional[int]] bot_public: NotRequired[bool] bot_require_code_grant: NotRequired[bool] - bot_disabled: NotRequired[bool] integration_public: NotRequired[bool] integration_require_code_grant: NotRequired[bool] guild_id: NotRequired[Snowflake] @@ -108,6 +107,8 @@ class ApplicationDiscoverability(TypedDict): class Application(PartialApplication, IntegrationApplication): + bot_disabled: NotRequired[bool] + bot_quarantined: NotRequired[bool] redirect_uris: List[str] interactions_endpoint_url: Optional[str] interactions_version: Literal[1, 2]