Skip to content

Conversation

@elenakrittik
Copy link
Contributor

@elenakrittik elenakrittik commented Jun 22, 2023

Summary

discord/discord-api-docs#6247

Official Discord client seem to check for whether a member is a guest by asserting not some_member.joined_at, so we'll do the same.

According to docs written by myself invite flags is an optional but not nullable flag. Though if some invite doesn't have flags, it is functionally equivalent to flags = 0, so the flags property is kept out of the Invite's docstring's table.

While not technically being a breaking change (for a reason only Danny and God know Member.joined_at is already optional despite official docs stating that it is always present), this PR actually introduces a real case when it can be optional. I'm not sure whether this should be mentioned in changelog as a breaking change, so decide yourself.

Checklist

  • If code changes were made, then they have been tested
    • I have updated the documentation to reflect the changes
    • I have formatted the code properly by running pdm lint
    • I have type-checked the code by running pdm pyright
  • This PR fixes an issue
  • This PR adds something new (e.g. new method or parameters)
  • This PR is a breaking change (e.g. methods or parameters removed/renamed)
  • This PR is not a code change (e.g. documentation, README, ...)

@Victorsitou Victorsitou added t: enhancement New feature t: api support Support of Discord API features s: in progress Issue/PR is being worked on s: waiting for api/docs Issue/PR is waiting for API support/documentation labels Jun 22, 2023
@Victorsitou Victorsitou added this to the disnake v2.10 milestone Jun 22, 2023
@elenakrittik elenakrittik changed the title feat: Guest invites feat!: Guest invites Jun 24, 2023
@elenakrittik elenakrittik changed the title feat!: Guest invites feat: Guest invites Jun 24, 2023
Copy link
Member

@shiftinv shiftinv left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!
The flags field is also sent in the INVITE_CREATE gateway event and as part of audit logs, those places would need updates as well.

Member.joined_at is already optional despite official docs stating that it is always present

it used to be optional with public stages, which got scrapped a while ago - I wouldn't consider this a breaking change on our end since it's already optional, but it's a breaking change on the API side :>

Copy link
Member

@shiftinv shiftinv left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A few more things I noticed recently.
Also, a more general issue: If all member cache flags are enabled, parse_voice_state_update currently ends up adding the guest to the cache, but does not remove them after leaving. Since the API also doesn't consider guests "real" members of a server, I think it would make sense to just not add them to cache in the first place.


@property
def flags(self) -> InviteFlags:
""":class:`InviteFlags`: Invite's flags.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
""":class:`InviteFlags`: Invite's flags.
""":class:`InviteFlags`: Returns the invite's flags.

:class:`bool`
Whether the member is a guest.
"""
return self.joined_at is None
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's also a new member flag, IS_GUEST = 1<<4, which should be more reliable for this. A utility method like this which just returns self.flags.is_guest is still useful, though.

@@ -0,0 +1 @@
Implement Guest invites. See also :attr:`disnake.Invite.flags`.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Implement Guest invites. See also :attr:`disnake.Invite.flags`.
Implement Guest invites. See :attr:`Invite.flags` and :attr:`Member.is_guest`.

@shiftinv shiftinv removed this from the disnake v2.10 milestone Dec 28, 2024
@shiftinv shiftinv removed the s: waiting for api/docs Issue/PR is waiting for API support/documentation label Jul 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

s: in progress Issue/PR is being worked on t: api support Support of Discord API features t: enhancement New feature

Projects

Status: Todo

Development

Successfully merging this pull request may close these issues.

3 participants