Add invite targets for voice channel invites

This commit is contained in:
Zomatree
2021-05-29 05:15:46 +01:00
committed by GitHub
parent f321efd4de
commit b48f510e15
10 changed files with 263 additions and 27 deletions

View File

@ -62,6 +62,7 @@ if TYPE_CHECKING:
from .channel import CategoryChannel
from .embeds import Embed
from .message import Message, MessageReference
from .enums import InviteTarget
SnowflakeTime = Union["Snowflake", datetime]
@ -1013,6 +1014,9 @@ class GuildChannel:
max_uses: int = 0,
temporary: bool = False,
unique: bool = True,
target_type: Optional[InviteTarget] = None,
target_user: Optional[User] = None,
target_application_id: Optional[int] = None
) -> Invite:
"""|coro|
@ -1038,6 +1042,20 @@ class GuildChannel:
invite.
reason: Optional[:class:`str`]
The reason for creating this invite. Shows up on the audit log.
target_type: Optional[:class:`InviteTarget`]
The type of target for the voice channel invite, if any.
.. versionadded:: 2.0
target_user: Optional[:class:`User`]
The user whose stream to display for this invite, required if `target_type` is `TargetType.stream`. The user must be streaming in the channel.
.. versionadded:: 2.0
target_application_id:: Optional[:class:`int`]
The id of the embedded application for the invite, required if `target_type` is `TargetType.embedded_application`.
.. versionadded:: 2.0
Raises
-------
@ -1060,6 +1078,9 @@ class GuildChannel:
max_uses=max_uses,
temporary=temporary,
unique=unique,
target_type=target_type.value if target_type else None,
target_user_id=target_user.id if target_user else None,
target_application_id=target_application_id
)
return Invite.from_incomplete(data=data, state=self._state)