Browse Source

Apply suggested changes

guest_invite -> guest
GuildInviteFlags -> InviteFlags
is_guest_invite -> guest

Co-Authored-By: dolfies <47677887+dolfies@users.noreply.github.com>
pull/10220/head
Soheab_ 3 weeks ago
parent
commit
73c564f4d4
  1. 16
      discord/abc.py
  2. 18
      discord/flags.py
  3. 8
      discord/invite.py
  4. 6
      docs/api.rst

16
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,

18
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

8
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.

6
docs/api.rst

@ -5734,12 +5734,12 @@ EmbedFlags
.. autoclass:: EmbedFlags()
:members:
GuildInviteFlags
InviteFlags
~~~~~~~~~~~~~~~~
.. attributetable:: GuildInviteFlags
.. attributetable:: InviteFlags
.. autoclass:: GuildInviteFlags()
.. autoclass:: InviteFlags()
:members:
ForumTag

Loading…
Cancel
Save