|
@ -60,6 +60,7 @@ from .http import handle_message_parameters |
|
|
from .voice_client import VoiceClient, VoiceProtocol |
|
|
from .voice_client import VoiceClient, VoiceProtocol |
|
|
from .sticker import GuildSticker, StickerItem |
|
|
from .sticker import GuildSticker, StickerItem |
|
|
from . import utils |
|
|
from . import utils |
|
|
|
|
|
from .flags import InviteFlags |
|
|
|
|
|
|
|
|
__all__ = ( |
|
|
__all__ = ( |
|
|
'Snowflake', |
|
|
'Snowflake', |
|
@ -1257,6 +1258,7 @@ class GuildChannel: |
|
|
target_type: Optional[InviteTarget] = None, |
|
|
target_type: Optional[InviteTarget] = None, |
|
|
target_user: Optional[User] = None, |
|
|
target_user: Optional[User] = None, |
|
|
target_application_id: Optional[int] = None, |
|
|
target_application_id: Optional[int] = None, |
|
|
|
|
|
guest: bool = False, |
|
|
) -> Invite: |
|
|
) -> Invite: |
|
|
"""|coro| |
|
|
"""|coro| |
|
|
|
|
|
|
|
@ -1295,6 +1297,10 @@ class GuildChannel: |
|
|
The id of the embedded application for the invite, required if ``target_type`` is :attr:`.InviteTarget.embedded_application`. |
|
|
The id of the embedded application for the invite, required if ``target_type`` is :attr:`.InviteTarget.embedded_application`. |
|
|
|
|
|
|
|
|
.. versionadded:: 2.0 |
|
|
.. versionadded:: 2.0 |
|
|
|
|
|
guest: :class:`bool` |
|
|
|
|
|
Whether the invite is a guest invite. |
|
|
|
|
|
|
|
|
|
|
|
.. versionadded:: 2.6 |
|
|
|
|
|
|
|
|
Raises |
|
|
Raises |
|
|
------- |
|
|
------- |
|
@ -1312,6 +1318,11 @@ class GuildChannel: |
|
|
if target_type is InviteTarget.unknown: |
|
|
if target_type is InviteTarget.unknown: |
|
|
raise ValueError('Cannot create invite with an unknown target type') |
|
|
raise ValueError('Cannot create invite with an unknown target type') |
|
|
|
|
|
|
|
|
|
|
|
flags: Optional[InviteFlags] = None |
|
|
|
|
|
if guest: |
|
|
|
|
|
flags = InviteFlags._from_value(0) |
|
|
|
|
|
flags.guest = True |
|
|
|
|
|
|
|
|
data = await self._state.http.create_invite( |
|
|
data = await self._state.http.create_invite( |
|
|
self.id, |
|
|
self.id, |
|
|
reason=reason, |
|
|
reason=reason, |
|
@ -1322,6 +1333,7 @@ class GuildChannel: |
|
|
target_type=target_type.value if target_type else None, |
|
|
target_type=target_type.value if target_type else None, |
|
|
target_user_id=target_user.id if target_user else None, |
|
|
target_user_id=target_user.id if target_user else None, |
|
|
target_application_id=target_application_id, |
|
|
target_application_id=target_application_id, |
|
|
|
|
|
flags=flags.value if flags else None, |
|
|
) |
|
|
) |
|
|
return Invite.from_incomplete(data=data, state=self._state) |
|
|
return Invite.from_incomplete(data=data, state=self._state) |
|
|
|
|
|
|
|
|