Skip to content

Commit ec89425

Browse files
committed
Don't always send flags
1 parent ca13ea3 commit ec89425

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

discord/abc.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1320,8 +1320,9 @@ async def create_invite(
13201320
if target_type is InviteTarget.unknown:
13211321
raise ValueError('Cannot create invite with an unknown target type')
13221322

1323-
flags = GuildInviteFlags._from_value(0)
1323+
flags: Optional[GuildInviteFlags] = None
13241324
if guest_invite:
1325+
flags = GuildInviteFlags._from_value(0)
13251326
flags.is_guest_invite = True
13261327

13271328
data = await self._state.http.create_invite(
@@ -1334,7 +1335,7 @@ async def create_invite(
13341335
target_type=target_type.value if target_type else None,
13351336
target_user_id=target_user.id if target_user else None,
13361337
target_application_id=target_application_id,
1337-
flags=flags.value,
1338+
flags=flags.value if flags else None,
13381339
)
13391340
return Invite.from_incomplete(data=data, state=self._state)
13401341

discord/http.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1853,7 +1853,7 @@ def create_invite(
18531853
if target_application_id:
18541854
payload['target_application_id'] = str(target_application_id)
18551855

1856-
if flags is not None:
1856+
if flags:
18571857
payload['flags'] = flags
18581858

18591859
return self.request(r, reason=reason, json=payload)

0 commit comments

Comments
 (0)