Skip to content

Commit

Permalink
Fix edge case in Client.leave_guild()
Browse files Browse the repository at this point in the history
  • Loading branch information
dolfies committed Jan 1, 2024
1 parent 7561e63 commit adcd6fd
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions discord/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -1961,15 +1961,14 @@ async def leave_guild(self, guild: Snowflake, /, lurking: bool = MISSING) -> Non
HTTPException
Leaving the guild failed.
"""
lurking = lurking if lurking is not MISSING else MISSING
if lurking is MISSING:
attr = getattr(guild, 'joined', lurking)
if attr is not MISSING:
lurking = not attr
elif (new_guild := self._connection._get_guild(guild.id)) is not None:
lurking = not new_guild.is_joined()

await self.http.leave_guild(guild.id, lurking=lurking)
await self.http.leave_guild(guild.id, lurking=lurking or False)

async def fetch_stage_instance(self, channel_id: int, /) -> StageInstance:
"""|coro|
Expand Down

0 comments on commit adcd6fd

Please sign in to comment.