-
Notifications
You must be signed in to change notification settings - Fork 148
feat(invite): implement community invites #1511
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
Snipy7374
wants to merge
16
commits into
DisnakeDev:master
Choose a base branch
from
Snipy7374:feat/community_invites
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 1 commit
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
909d1f6
implement community invites
Snipy7374 b6a288f
Update disnake/abc.py
Snipy7374 4eecb98
Update disnake/abc.py
Snipy7374 79da010
Update disnake/abc.py
Snipy7374 e4f5271
Update disnake/flags.py
Snipy7374 bd7dd08
Update disnake/invite.py
Snipy7374 891a66b
Update disnake/invite.py
Snipy7374 c9e0f3e
Update disnake/invite.py
Snipy7374 58573ff
Update disnake/invite.py
Snipy7374 155d94a
Update disnake/invite.py
Snipy7374 caf03f6
Update disnake/abc.py
Snipy7374 5d4d920
Update disnake/invite.py
Snipy7374 2970aa4
apply changes to to_multipart
Snipy7374 136da6f
Merge branch 'feat/community_invites' of github.com:Snipy7374/disnake…
Snipy7374 4a635be
make roles a Collection
Snipy7374 dffc5e9
change codeblocks
Snipy7374 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| Add the new :meth:`Invite.fetch_target_users`, :meth:`Invite.update_target_users`, :meth:`Invite.fetch_target_users_job_status` methods as well as :attr:`Invite.roles`, :attr:`Invite.flags`, :class:`GuildInviteFlags`. Update :meth:`abc.GuildChannel.create_invite` to be able to specify ``roles`` and the ``target_users_file``. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -1300,10 +1300,12 @@ async def create_invite( | |||||
| unique: bool = True, | ||||||
| target_type: InviteTarget | None = None, | ||||||
| target_user: User | None = None, | ||||||
| target_users_file: File | None = None, | ||||||
| target_application: Snowflake | PartyType | None = None, | ||||||
| guild_scheduled_event: GuildScheduledEvent | None = None, | ||||||
| roles: list[Role] | None = None, | ||||||
| ) -> Invite: | ||||||
| """|coro| | ||||||
| r"""|coro| | ||||||
|
|
||||||
| Creates an instant invite from a text or voice channel. | ||||||
|
|
||||||
|
|
@@ -1336,6 +1338,17 @@ async def create_invite( | |||||
|
|
||||||
| .. versionadded:: 2.0 | ||||||
|
|
||||||
| target_users_file: :class:`~disnake.File` | :data:`None` | ||||||
| A csv file with a list of users able to accept the invite. | ||||||
| This file must only have valid user ids separated by ``/n``. | ||||||
|
Snipy7374 marked this conversation as resolved.
Outdated
|
||||||
| A valid file content would look like this: :: | ||||||
|
Snipy7374 marked this conversation as resolved.
Outdated
|
||||||
|
|
||||||
| 710570210159099984 | ||||||
| 1081815963990761542 | ||||||
| ... other user ids | ||||||
|
|
||||||
| .. versionadded:: 2.13 | ||||||
|
Snipy7374 marked this conversation as resolved.
Outdated
|
||||||
|
|
||||||
| target_application: :class:`.Snowflake` | :data:`None` | ||||||
| The ID of the embedded application for the invite, required if ``target_type`` is :attr:`.InviteTarget.embedded_application`. | ||||||
|
|
||||||
|
|
@@ -1349,6 +1362,13 @@ async def create_invite( | |||||
|
|
||||||
| .. versionadded:: 2.3 | ||||||
|
|
||||||
| roles: :class:`list`\[:class:`.Role`] | :data:`None` | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
| A list of roles added to the user upon accepting the invite. | ||||||
| You must have the :attr:`.Permissions.manage_roles` permission and cannot assign roles with | ||||||
| higher permissions than you to do this. | ||||||
|
Snipy7374 marked this conversation as resolved.
Outdated
|
||||||
|
|
||||||
| .. versionadded:: 2.13 | ||||||
|
Snipy7374 marked this conversation as resolved.
Outdated
|
||||||
|
|
||||||
| reason: :class:`str` | :data:`None` | ||||||
| The reason for creating this invite. Shows up on the audit log. | ||||||
|
|
||||||
|
|
@@ -1379,7 +1399,9 @@ async def create_invite( | |||||
| unique=unique, | ||||||
| target_type=try_enum_to_int(target_type), | ||||||
| target_user_id=target_user.id if target_user else None, | ||||||
| target_users_file=target_users_file, | ||||||
| target_application_id=target_application.id if target_application else None, | ||||||
| role_ids=[r.id for r in roles] if roles else None, | ||||||
| ) | ||||||
| invite = Invite.from_incomplete(data=data, state=self._state) | ||||||
| invite.guild_scheduled_event = guild_scheduled_event | ||||||
|
|
||||||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.