feat(invite): implement community invites#1511
feat(invite): implement community invites#1511Snipy7374 wants to merge 16 commits intoDisnakeDev:masterfrom
Conversation
| created_at: datetime | ||
| completed_at: datetime | None |
There was a problem hiding this comment.
Hmm, do we use datetime in TypedDicts anywhere else?
What's the reason some of those are str and some datetime?
There was a problem hiding this comment.
The reason is that the ones with str are to annotate the payload returned by the dAPI, the ones with datetime are for our users because I thought this endpoint didn't need its whole class to represent the model, a dict is sufficient IMO, so that's why I defined another typed dict, so our users will know the types and the keys in code too
| self.flags = GuildInviteFlags._from_value(data.get("flags", 0)) | ||
| self.roles = [ | ||
| Role( | ||
| guild=self.guild, |
There was a problem hiding this comment.
There's a type error on this line
There was a problem hiding this comment.
I know but idk what to do, when could guild even be none, only if not cached in theory, Role needs it tho
| return { | ||
| "status": data["status"], | ||
| "total_users": data["total_users"], | ||
| "processed_users": data["processed_users"], | ||
| "created_at": parse_time(data["created_at"]), | ||
| "completed_at": parse_time(data["completed_at"]), | ||
| "error_message": data["error_message"], | ||
| } |
There was a problem hiding this comment.
This should be a small NamedTuple or a dataclass, I think it's unprecedented to return a dict from a public method
There was a problem hiding this comment.
For an endpoint it's unprecedented yes, I did it because for this specific endpoint it doesn't make sense to me to have a whole class, so yeah I'll switch to a NamedTuple
Co-authored-by: Eneg <42005170+Enegg@users.noreply.github.com> Signed-off-by: Snipy7374 <100313469+Snipy7374@users.noreply.github.com>
Co-authored-by: Eneg <42005170+Enegg@users.noreply.github.com> Signed-off-by: Snipy7374 <100313469+Snipy7374@users.noreply.github.com>
Co-authored-by: Eneg <42005170+Enegg@users.noreply.github.com> Signed-off-by: Snipy7374 <100313469+Snipy7374@users.noreply.github.com>
Co-authored-by: Eneg <42005170+Enegg@users.noreply.github.com> Signed-off-by: Snipy7374 <100313469+Snipy7374@users.noreply.github.com>
Co-authored-by: Eneg <42005170+Enegg@users.noreply.github.com> Signed-off-by: Snipy7374 <100313469+Snipy7374@users.noreply.github.com>
Co-authored-by: Eneg <42005170+Enegg@users.noreply.github.com> Signed-off-by: Snipy7374 <100313469+Snipy7374@users.noreply.github.com>
Co-authored-by: Eneg <42005170+Enegg@users.noreply.github.com> Signed-off-by: Snipy7374 <100313469+Snipy7374@users.noreply.github.com>
Co-authored-by: Eneg <42005170+Enegg@users.noreply.github.com> Signed-off-by: Snipy7374 <100313469+Snipy7374@users.noreply.github.com>
Co-authored-by: Eneg <42005170+Enegg@users.noreply.github.com> Signed-off-by: Snipy7374 <100313469+Snipy7374@users.noreply.github.com>
Co-authored-by: Eneg <42005170+Enegg@users.noreply.github.com> Signed-off-by: Snipy7374 <100313469+Snipy7374@users.noreply.github.com>
Co-authored-by: Eneg <42005170+Enegg@users.noreply.github.com> Signed-off-by: Snipy7374 <100313469+Snipy7374@users.noreply.github.com>
… into feat/community_invites
|
|
||
| .. versionadded:: 2.3 | ||
|
|
||
| roles: :class:`list`\[:class:`.Role`] | :data:`None` |
There was a problem hiding this comment.
| roles: :class:`list`\[:class:`.Role`] | :data:`None` | |
| roles: :class:`~collections.abc.Collection`\[:class:`.Role`] | :data:`None` |
| self.guild_scheduled_event: GuildScheduledEvent | None = None | ||
|
|
||
| self.flags = GuildInviteFlags._from_value(data.get("flags", 0)) | ||
| self.roles = [ |
There was a problem hiding this comment.
Since invites are Hashable, .roles should probably be an immutable sequence (tuple)
|
|
||
| Fetch the csv file with the target users for this invite. | ||
| You must have the :attr:`~Permissions.manage_guild` or :attr:`~Permissions.view_audit_log` | ||
| permissions or to be the inviter to do this. |
There was a problem hiding this comment.
| permissions or to be the inviter to do this. | |
| permissions or be the inviter to do this. |
| """|coro| | ||
|
|
||
| Update the target users for this invite. | ||
| You must have the :attr:`~Permissions.manage_guild` permission or to be the inviter to do this. |
There was a problem hiding this comment.
| You must have the :attr:`~Permissions.manage_guild` permission or to be the inviter to do this. | |
| You must have the :attr:`~Permissions.manage_guild` permission or be the inviter to do this. |
Summary
Checklist
uv run nox -s lintuv run nox -s pyright