From 73c564f4d4eaf7747c44416864705af1ef24cc0a Mon Sep 17 00:00:00 2001 From: Soheab_ <33902984+Soheab@users.noreply.github.com> Date: Wed, 2 Jul 2025 20:47:37 +0200 Subject: [PATCH] Apply suggested changes guest_invite -> guest GuildInviteFlags -> InviteFlags is_guest_invite -> guest Co-Authored-By: dolfies <47677887+dolfies@users.noreply.github.com> --- discord/abc.py | 16 +++++++--------- discord/flags.py | 18 +++++++++--------- discord/invite.py | 8 ++++---- docs/api.rst | 6 +++--- 4 files changed, 23 insertions(+), 25 deletions(-) diff --git a/discord/abc.py b/discord/abc.py index 270693724..713398a7d 100644 --- a/discord/abc.py +++ b/discord/abc.py @@ -60,7 +60,7 @@ from .http import handle_message_parameters from .voice_client import VoiceClient, VoiceProtocol from .sticker import GuildSticker, StickerItem from . import utils -from .flags import GuildInviteFlags +from .flags import InviteFlags __all__ = ( 'Snowflake', @@ -1258,7 +1258,7 @@ class GuildChannel: target_type: Optional[InviteTarget] = None, target_user: Optional[User] = None, target_application_id: Optional[int] = None, - guest_invite: bool = False, + guest: bool = False, ) -> Invite: """|coro| @@ -1297,11 +1297,9 @@ class GuildChannel: The id of the embedded application for the invite, required if ``target_type`` is :attr:`.InviteTarget.embedded_application`. .. versionadded:: 2.0 - guest_invite: :class:`bool` + guest: :class:`bool` Whether the invite is a guest invite. - This is only available to guilds that contain ``GUESTS_ENABLED`` in :attr:`.Guild.features`. - .. versionadded:: 2.6 Raises @@ -1320,10 +1318,10 @@ class GuildChannel: if target_type is InviteTarget.unknown: raise ValueError('Cannot create invite with an unknown target type') - flags: Optional[GuildInviteFlags] = None - if guest_invite: - flags = GuildInviteFlags._from_value(0) - flags.is_guest_invite = True + flags: Optional[InviteFlags] = None + if guest: + flags = InviteFlags._from_value(0) + flags.guest = True data = await self._state.http.create_invite( self.id, diff --git a/discord/flags.py b/discord/flags.py index 3327f2c75..59a4909b8 100644 --- a/discord/flags.py +++ b/discord/flags.py @@ -64,7 +64,7 @@ __all__ = ( 'AppInstallationType', 'SKUFlags', 'EmbedFlags', - 'GuildInviteFlags', + 'InviteFlags', ) BF = TypeVar('BF', bound='BaseFlags') @@ -2400,8 +2400,8 @@ class EmbedFlags(BaseFlags): return 1 << 5 -class GuildInviteFlags(BaseFlags): - r"""Wraps up the Discord Guild Invite flags +class InviteFlags(BaseFlags): + r"""Wraps up the Discord Invite flags .. versionadded:: 2.6 @@ -2409,25 +2409,25 @@ class GuildInviteFlags(BaseFlags): .. describe:: x == y - Checks if two GuildInviteFlags are equal. + Checks if two InviteFlags are equal. .. describe:: x != y - Checks if two GuildInviteFlags are not equal. + Checks if two InviteFlags are not equal. .. describe:: x | y, x |= y - Returns a GuildInviteFlags instance with all enabled flags from + Returns a InviteFlags instance with all enabled flags from both x and y. .. describe:: x ^ y, x ^= y - Returns a GuildInviteFlags instance with only flags enabled on + Returns a InviteFlags instance with only flags enabled on only one of x or y, not on both. .. describe:: ~x - Returns a GuildInviteFlags instance with all flags inverted from x. + Returns a InviteFlags instance with all flags inverted from x. .. describe:: hash(x) @@ -2451,6 +2451,6 @@ class GuildInviteFlags(BaseFlags): """ @flag_value - def is_guest_invite(self): + def guest(self): """:class:`bool`: Returns ``True`` if this is a guest invite for a voice channel.""" return 1 << 0 diff --git a/discord/invite.py b/discord/invite.py index cde6217e7..a015104b2 100644 --- a/discord/invite.py +++ b/discord/invite.py @@ -32,7 +32,7 @@ from .mixins import Hashable from .enums import ChannelType, NSFWLevel, VerificationLevel, InviteTarget, InviteType, try_enum from .appinfo import PartialAppInfo from .scheduled_event import ScheduledEvent -from .flags import GuildInviteFlags +from .flags import InviteFlags __all__ = ( 'PartialInviteChannel', @@ -527,12 +527,12 @@ class Invite(Hashable): return url @property - def flags(self) -> GuildInviteFlags: - """:class:`GuildInviteFlags`: Returns the flags for this guild invite. + def flags(self) -> InviteFlags: + """:class:`InviteFlags`: Returns the flags for this guild invite. .. versionadded:: 2.6 """ - return GuildInviteFlags._from_value(self._flags) + return InviteFlags._from_value(self._flags) def set_scheduled_event(self, scheduled_event: Snowflake, /) -> Self: """Sets the scheduled event for this invite. diff --git a/docs/api.rst b/docs/api.rst index 745896096..5f7ae846b 100644 --- a/docs/api.rst +++ b/docs/api.rst @@ -5734,12 +5734,12 @@ EmbedFlags .. autoclass:: EmbedFlags() :members: -GuildInviteFlags +InviteFlags ~~~~~~~~~~~~~~~~ -.. attributetable:: GuildInviteFlags +.. attributetable:: InviteFlags -.. autoclass:: GuildInviteFlags() +.. autoclass:: InviteFlags() :members: ForumTag