Skip to content

Commit 1e3567d

Browse files
committed
Merge branch 'refs/heads/pr-2994' into fix-auto-sync
2 parents 1118414 + a385c80 commit 1e3567d

29 files changed

Lines changed: 1928 additions & 69 deletions

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,12 @@ These changes are available on the `master` branch, but have not yet been releas
1212

1313
### Added
1414

15+
- Added support for community invites.
16+
([#3044](https://github.com/Pycord-Development/pycord/pull/3044))
1517
- Added `Member.colours` and `Member.colors` properties.
1618
([#3063](https://github.com/Pycord-Development/pycord/pull/3063))
19+
- Added `RadioGroup`, `CheckboxGroup`, and `Checkbox` for modals.
20+
([#3073](https://github.com/Pycord-Development/pycord/pull/3073))
1721
- Added the ability to respond to interactions with suppressed push and desktop
1822
notifications. ([#3062](https://github.com/Pycord-Development/pycord/pull/3062))
1923
- Added `User.collectibles` property.

discord/abc.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@
5050
from .invite import Invite
5151
from .iterators import HistoryIterator, MessagePinIterator
5252
from .mentions import AllowedMentions
53+
from .object import Object
5354
from .partial_emoji import PartialEmoji, _EmojiTag
5455
from .permissions import PermissionOverwrite, Permissions
5556
from .role import Role
@@ -1208,6 +1209,8 @@ async def create_invite(
12081209
target_type: InviteTarget | None = None,
12091210
target_user: User | None = None,
12101211
target_application_id: int | None = None,
1212+
roles: list[Role | Object] | None = None,
1213+
target_users_file: File | None = None,
12111214
) -> Invite:
12121215
"""|coro|
12131216
@@ -1259,6 +1262,20 @@ async def create_invite(
12591262
12601263
.. versionadded:: 2.0
12611264
1265+
roles: Optional[List[Union[:class:`.Role`, :class:`.Object`]]]
1266+
The roles to give a user when joining through this invite.
1267+
1268+
You must have the :attr:`~Permissions.manage_roles` permission to do this and roles cannot be higher than your own.
1269+
1270+
.. versionadded:: 2.8
1271+
1272+
target_users_file: Optional[:class:`File`]
1273+
A CSV file with a single column of user IDs for all the users able to accept this invite.
1274+
1275+
You can use :func:`utils.users_to_csv` to generate a virtual CSV file from a sequence of user IDs.
1276+
1277+
.. versionadded:: 2.8
1278+
12621279
Returns
12631280
-------
12641281
:class:`~discord.Invite`
@@ -1283,8 +1300,11 @@ async def create_invite(
12831300
target_type=target_type.value if target_type else None,
12841301
target_user_id=target_user.id if target_user else None,
12851302
target_application_id=target_application_id,
1303+
roles=[str(r.id) for r in roles] if roles else None,
1304+
target_users_file=target_users_file,
12861305
)
12871306
invite = Invite.from_incomplete(data=data, state=self._state)
1307+
12881308
if target_event:
12891309
invite.set_scheduled_event(target_event)
12901310
return invite

discord/appinfo.py

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,7 @@ def __init__(self, state: ConnectionState, data: AppInfoPayload):
265265
self.approximate_user_authorization_count: int | None = data.get(
266266
"approximate_user_authorization_count"
267267
)
268-
self._flags: int | None = data.get("flags")
268+
self._flags: int = data.get("flags", 0)
269269
self.redirect_uris: list[str] = data.get("redirect_uris", [])
270270
self.interactions_endpoint_url: str | None = data.get(
271271
"interactions_endpoint_url"
@@ -300,15 +300,13 @@ def __repr__(self) -> str:
300300
)
301301

302302
@property
303-
def flags(self) -> ApplicationFlags | None:
304-
"""The public application flags, if set.
303+
def flags(self) -> ApplicationFlags:
304+
"""The public application flags.
305305
306-
Returns an :class:`ApplicationFlags` instance or ``None`` when not present.
306+
Returns an :class:`ApplicationFlags` instance.
307307
308308
.. versionadded:: 2.8
309309
"""
310-
if self._flags is None:
311-
return None
312310
return ApplicationFlags._from_value(self._flags)
313311

314312
async def edit(
@@ -596,8 +594,8 @@ def __init__(
596594
guild: AppInstallParams | None = utils.MISSING,
597595
user: AppInstallParams | None = utils.MISSING,
598596
) -> None:
599-
self.guild = guild
600-
self.user = user
597+
self.guild: AppInstallParams | None = guild
598+
self.user: AppInstallParams | None = user
601599

602600
@staticmethod
603601
def _get_ctx(

0 commit comments

Comments
 (0)