Browse Source

Add Application.quarantined attribute

pull/10109/head
dolfies 2 years ago
parent
commit
6ad3f755a7
  1. 20
      discord/application.py
  2. 3
      discord/types/application.py

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

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

Loading…
Cancel
Save