diff --git a/discord/application.py b/discord/application.py index 2e43d3bc7..3ef1e1461 100644 --- a/discord/application.py +++ b/discord/application.py @@ -1760,6 +1760,7 @@ class PartialApplication(Hashable): 'owner', 'team', '_guild', + '_has_bot', ) if TYPE_CHECKING: @@ -1823,12 +1824,9 @@ class PartialApplication(Hashable): else None ) - self.public: bool = data.get( - 'integration_public', data.get('bot_public', True) - ) - self.require_code_grant: bool = data.get( - 'integration_require_code_grant', data.get('bot_require_code_grant', False) - ) + self.public: bool = data.get('integration_public', data.get('bot_public', True)) + self.require_code_grant: bool = data.get('integration_require_code_grant', data.get('bot_require_code_grant', False)) + self._has_bot: bool = 'bot_public' in data # Hacky, but I want these to be persisted @@ -1903,6 +1901,13 @@ class PartialApplication(Hashable): """Optional[:class:`Guild`]: The guild linked to the application, if any and available.""" return self._state._get_guild(self.guild_id) or self._guild + def has_bot(self) -> bool: + """:class:`bool`: Whether the application has an attached bot. + + .. versionadded:: 2.1 + """ + return self._has_bot + async def assets(self) -> List[ApplicationAsset]: """|coro| @@ -2218,6 +2223,13 @@ class Application(PartialApplication): """:class:`ApplicationDiscoveryFlags`: The directory eligibility flags for this application.""" return ApplicationDiscoveryFlags._from_value(self._discovery_eligibility_flags) + def has_bot(self) -> bool: + """:class:`bool`: Whether the application has an attached bot. + + .. versionadded:: 2.1 + """ + return self.bot is not None + async def edit( self, *, @@ -2354,7 +2366,11 @@ class Application(PartialApplication): else: payload['integration_require_code_grant'] = require_code_grant if discoverable is not MISSING: - payload['discoverability_state'] = ApplicationDiscoverabilityState.discoverable.value if discoverable else ApplicationDiscoverabilityState.not_discoverable.value + payload['discoverability_state'] = ( + ApplicationDiscoverabilityState.discoverable.value + if discoverable + else ApplicationDiscoverabilityState.not_discoverable.value + ) if max_participants is not MISSING: payload['max_participants'] = max_participants if flags is not MISSING: diff --git a/discord/audit_logs.py b/discord/audit_logs.py index 8e0b216cd..636288b73 100644 --- a/discord/audit_logs.py +++ b/discord/audit_logs.py @@ -228,7 +228,6 @@ def _guild_hash_transformer(path: str) -> Callable[[AuditLogEntry, Optional[str] def _transform_automod_trigger_metadata( entry: AuditLogEntry, data: AutoModerationTriggerMetadata ) -> Optional[AutoModTrigger]: - if isinstance(entry.target, AutoModRule): # Trigger type cannot be changed, so type should be the same before and after updates. # Avoids checking which keys are in data to guess trigger type diff --git a/discord/embeds.py b/discord/embeds.py index 7ba404e56..665b97cbf 100644 --- a/discord/embeds.py +++ b/discord/embeds.py @@ -175,7 +175,6 @@ class Embed: description: Optional[Any] = None, timestamp: Optional[datetime.datetime] = None, ): - self.colour = colour if colour is not None else color self.title: Optional[str] = title self.type: EmbedType = type diff --git a/discord/ext/commands/_types.py b/discord/ext/commands/_types.py index 9856a75d4..f8406cb59 100644 --- a/discord/ext/commands/_types.py +++ b/discord/ext/commands/_types.py @@ -62,7 +62,6 @@ ContextT_co = TypeVar('ContextT_co', bound='Context[Any]', covariant=True) class Check(Protocol[ContextT_co]): # type: ignore # TypeVar is expected to be invariant - predicate: Callable[[ContextT_co], Coroutine[Any, Any, bool]] def __call__(self, coro_or_commands: T) -> T: diff --git a/discord/ext/commands/core.py b/discord/ext/commands/core.py index 851a22e8d..6ff69ac3b 100644 --- a/discord/ext/commands/core.py +++ b/discord/ext/commands/core.py @@ -1512,7 +1512,6 @@ class GroupMixin(Generic[CogT]): """ def decorator(func): - kwargs.setdefault('parent', self) result = command(name=name, cls=cls, *args, **kwargs)(func) self.add_command(result) diff --git a/discord/permissions.py b/discord/permissions.py index a6856f8a3..37962062e 100644 --- a/discord/permissions.py +++ b/discord/permissions.py @@ -35,6 +35,7 @@ __all__ = ( if TYPE_CHECKING: from typing_extensions import Self + # A permission alias works like a regular flag but is marked # So the PermissionOverwrite knows to work with it class permission_alias(alias_flag_value):