aboutsummaryrefslogtreecommitdiff
path: root/discord/invite.py
diff options
context:
space:
mode:
authorZomatree <[email protected]>2021-05-29 05:15:46 +0100
committerGitHub <[email protected]>2021-05-29 00:15:46 -0400
commitb48f510e154e40b8ba3bef58e5c513fccf90c89c (patch)
tree917f2da2ee25e0fcac4fbc9e3762d89c4d10e604 /discord/invite.py
parentDefault SelectOption.value to the label if not given (diff)
downloaddiscord.py-b48f510e154e40b8ba3bef58e5c513fccf90c89c.tar.xz
discord.py-b48f510e154e40b8ba3bef58e5c513fccf90c89c.zip
Add invite targets for voice channel invites
Diffstat (limited to 'discord/invite.py')
-rw-r--r--discord/invite.py20
1 files changed, 16 insertions, 4 deletions
diff --git a/discord/invite.py b/discord/invite.py
index 213ef5a4..8e60d1e8 100644
--- a/discord/invite.py
+++ b/discord/invite.py
@@ -30,6 +30,7 @@ from .utils import parse_time, snowflake_time, _get_as_snowflake
from .object import Object
from .mixins import Hashable
from .enums import ChannelType, VerificationLevel, InviteTarget, try_enum
+from .appinfo import PartialAppInfo
__all__ = (
'PartialInviteChannel',
@@ -277,12 +278,18 @@ class Invite(Hashable):
channel: Union[:class:`abc.GuildChannel`, :class:`Object`, :class:`PartialInviteChannel`]
The channel the invite is for.
+ target_type: :class:`InviteTarget`
+ The type of target for the voice channel invite.
+
+ .. versionadded:: 2.0
+
target_user: Optional[:class:`User`]
- The target of this invite in the case of stream invites.
+ The user whose stream to display for this invite, if any.
.. versionadded:: 2.0
- target_type: :class:`InviteTarget`
- The invite's target type.
+
+ target_application: Optional[:class:`PartialAppInfo`]
+ The embedded application the invite targets, if any.
.. versionadded:: 2.0
"""
@@ -303,6 +310,7 @@ class Invite(Hashable):
'_state',
'approximate_member_count',
'approximate_presence_count',
+ 'target_application',
'expires_at',
)
@@ -328,7 +336,11 @@ class Invite(Hashable):
self.channel = data.get('channel')
target_user_data = data.get('target_user')
self.target_user = None if target_user_data is None else self._state.store_user(target_user_data)
- self.target_type = try_enum(InviteTarget, data.get('target_type', 0))
+
+ self.target_type = try_enum(InviteTarget, data.get("target_type", 0))
+
+ application = data.get('target_application')
+ self.target_application = PartialAppInfo(data=application, state=state) if application else None
@classmethod
def from_incomplete(cls, *, state, data):