Skip to content

Commit 73c564f

Browse files
Soheabdolfies
andcommitted
Apply suggested changes
guest_invite -> guest GuildInviteFlags -> InviteFlags is_guest_invite -> guest Co-Authored-By: dolfies <[email protected]>
1 parent f21a0c2 commit 73c564f

File tree

4 files changed

+23
-25
lines changed

4 files changed

+23
-25
lines changed

discord/abc.py

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@
6060
from .voice_client import VoiceClient, VoiceProtocol
6161
from .sticker import GuildSticker, StickerItem
6262
from . import utils
63-
from .flags import GuildInviteFlags
63+
from .flags import InviteFlags
6464

6565
__all__ = (
6666
'Snowflake',
@@ -1258,7 +1258,7 @@ async def create_invite(
12581258
target_type: Optional[InviteTarget] = None,
12591259
target_user: Optional[User] = None,
12601260
target_application_id: Optional[int] = None,
1261-
guest_invite: bool = False,
1261+
guest: bool = False,
12621262
) -> Invite:
12631263
"""|coro|
12641264
@@ -1297,11 +1297,9 @@ async def create_invite(
12971297
The id of the embedded application for the invite, required if ``target_type`` is :attr:`.InviteTarget.embedded_application`.
12981298
12991299
.. versionadded:: 2.0
1300-
guest_invite: :class:`bool`
1300+
guest: :class:`bool`
13011301
Whether the invite is a guest invite.
13021302
1303-
This is only available to guilds that contain ``GUESTS_ENABLED`` in :attr:`.Guild.features`.
1304-
13051303
.. versionadded:: 2.6
13061304
13071305
Raises
@@ -1320,10 +1318,10 @@ async def create_invite(
13201318
if target_type is InviteTarget.unknown:
13211319
raise ValueError('Cannot create invite with an unknown target type')
13221320

1323-
flags: Optional[GuildInviteFlags] = None
1324-
if guest_invite:
1325-
flags = GuildInviteFlags._from_value(0)
1326-
flags.is_guest_invite = True
1321+
flags: Optional[InviteFlags] = None
1322+
if guest:
1323+
flags = InviteFlags._from_value(0)
1324+
flags.guest = True
13271325

13281326
data = await self._state.http.create_invite(
13291327
self.id,

discord/flags.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@
6464
'AppInstallationType',
6565
'SKUFlags',
6666
'EmbedFlags',
67-
'GuildInviteFlags',
67+
'InviteFlags',
6868
)
6969

7070
BF = TypeVar('BF', bound='BaseFlags')
@@ -2400,34 +2400,34 @@ def content_inventory_entry(self):
24002400
return 1 << 5
24012401

24022402

2403-
class GuildInviteFlags(BaseFlags):
2404-
r"""Wraps up the Discord Guild Invite flags
2403+
class InviteFlags(BaseFlags):
2404+
r"""Wraps up the Discord Invite flags
24052405
24062406
.. versionadded:: 2.6
24072407
24082408
.. container:: operations
24092409
24102410
.. describe:: x == y
24112411
2412-
Checks if two GuildInviteFlags are equal.
2412+
Checks if two InviteFlags are equal.
24132413
24142414
.. describe:: x != y
24152415
2416-
Checks if two GuildInviteFlags are not equal.
2416+
Checks if two InviteFlags are not equal.
24172417
24182418
.. describe:: x | y, x |= y
24192419
2420-
Returns a GuildInviteFlags instance with all enabled flags from
2420+
Returns a InviteFlags instance with all enabled flags from
24212421
both x and y.
24222422
24232423
.. describe:: x ^ y, x ^= y
24242424
2425-
Returns a GuildInviteFlags instance with only flags enabled on
2425+
Returns a InviteFlags instance with only flags enabled on
24262426
only one of x or y, not on both.
24272427
24282428
.. describe:: ~x
24292429
2430-
Returns a GuildInviteFlags instance with all flags inverted from x.
2430+
Returns a InviteFlags instance with all flags inverted from x.
24312431
24322432
.. describe:: hash(x)
24332433
@@ -2451,6 +2451,6 @@ class GuildInviteFlags(BaseFlags):
24512451
"""
24522452

24532453
@flag_value
2454-
def is_guest_invite(self):
2454+
def guest(self):
24552455
""":class:`bool`: Returns ``True`` if this is a guest invite for a voice channel."""
24562456
return 1 << 0

discord/invite.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
from .enums import ChannelType, NSFWLevel, VerificationLevel, InviteTarget, InviteType, try_enum
3333
from .appinfo import PartialAppInfo
3434
from .scheduled_event import ScheduledEvent
35-
from .flags import GuildInviteFlags
35+
from .flags import InviteFlags
3636

3737
__all__ = (
3838
'PartialInviteChannel',
@@ -527,12 +527,12 @@ def url(self) -> str:
527527
return url
528528

529529
@property
530-
def flags(self) -> GuildInviteFlags:
531-
""":class:`GuildInviteFlags`: Returns the flags for this guild invite.
530+
def flags(self) -> InviteFlags:
531+
""":class:`InviteFlags`: Returns the flags for this guild invite.
532532
533533
.. versionadded:: 2.6
534534
"""
535-
return GuildInviteFlags._from_value(self._flags)
535+
return InviteFlags._from_value(self._flags)
536536

537537
def set_scheduled_event(self, scheduled_event: Snowflake, /) -> Self:
538538
"""Sets the scheduled event for this invite.

docs/api.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5734,12 +5734,12 @@ EmbedFlags
57345734
.. autoclass:: EmbedFlags()
57355735
:members:
57365736

5737-
GuildInviteFlags
5737+
InviteFlags
57385738
~~~~~~~~~~~~~~~~
57395739

5740-
.. attributetable:: GuildInviteFlags
5740+
.. attributetable:: InviteFlags
57415741

5742-
.. autoclass:: GuildInviteFlags()
5742+
.. autoclass:: InviteFlags()
57435743
:members:
57445744

57455745
ForumTag

0 commit comments

Comments
 (0)