From 0dcf69e102acd845a501bcca0b5016d3bc1739da Mon Sep 17 00:00:00 2001 From: dolfies Date: Tue, 22 Aug 2023 19:40:02 +0300 Subject: [PATCH] Add Application.disabled attribute --- discord/application.py | 14 ++++++++++++++ discord/types/application.py | 1 + 2 files changed, 15 insertions(+) diff --git a/discord/application.py b/discord/application.py index 181172aa7..3a8d4f58f 100644 --- a/discord/application.py +++ b/discord/application.py @@ -707,6 +707,14 @@ class ApplicationBot(User): """:class:`bool`: Whether the bot requires the completion of the full OAuth2 code grant flow to join.""" return self.application.require_code_grant + @property + def disabled(self) -> bool: + """:class:`bool`: Whether the bot is disabled by Discord. + + .. versionadded:: 2.1 + """ + return self.application.disabled + @property def bio(self) -> Optional[str]: """Optional[:class:`str`]: Returns the bot's 'about me' section.""" @@ -2270,6 +2278,10 @@ class Application(PartialApplication): The application owner. This may be a team user account. bot: Optional[:class:`ApplicationBot`] The bot attached to the application, if any. + disabled: :class:`bool` + Whether the bot attached to this application is disabled by Discord. + + .. versionadded:: 2.1 interactions_endpoint_url: Optional[:class:`str`] The URL interactions will be sent to, if set. role_connections_verification_url: Optional[:class:`str`] @@ -2297,6 +2309,7 @@ class Application(PartialApplication): 'interactions_endpoint_url', 'role_connections_verification_url', 'bot', + 'disabled', 'verification_state', 'store_application_state', 'rpc_application_state', @@ -2315,6 +2328,7 @@ class Application(PartialApplication): def _update(self, data: ApplicationPayload) -> None: super()._update(data) + self.disabled = data.get('bot_disabled', 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 653b55aae..754fb14ee 100644 --- a/discord/types/application.py +++ b/discord/types/application.py @@ -84,6 +84,7 @@ 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]