Browse Source

Add Application.disabled attribute

pull/10109/head
dolfies 2 years ago
parent
commit
0dcf69e102
  1. 14
      discord/application.py
  2. 1
      discord/types/application.py

14
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')

1
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]

Loading…
Cancel
Save