mirror of
https://github.com/Rapptz/discord.py.git
synced 2025-06-06 11:57:17 +00:00
Add target_user and target_type to Invite objects
This commit is contained in:
parent
f4165755a9
commit
67abfea61a
@ -46,6 +46,7 @@ __all__ = (
|
|||||||
'ExpireBehaviour',
|
'ExpireBehaviour',
|
||||||
'ExpireBehavior',
|
'ExpireBehavior',
|
||||||
'StickerType',
|
'StickerType',
|
||||||
|
'InviteTarget',
|
||||||
'VideoQualityMode',
|
'VideoQualityMode',
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -426,6 +427,11 @@ class StickerType(Enum):
|
|||||||
apng = 2
|
apng = 2
|
||||||
lottie = 3
|
lottie = 3
|
||||||
|
|
||||||
|
class InviteTarget(Enum):
|
||||||
|
unknown = 0
|
||||||
|
stream = 1
|
||||||
|
embedded_application = 2
|
||||||
|
|
||||||
class InteractionType(Enum):
|
class InteractionType(Enum):
|
||||||
ping = 1
|
ping = 1
|
||||||
application_command = 2
|
application_command = 2
|
||||||
|
@ -29,7 +29,7 @@ from .asset import Asset
|
|||||||
from .utils import parse_time, snowflake_time, _get_as_snowflake
|
from .utils import parse_time, snowflake_time, _get_as_snowflake
|
||||||
from .object import Object
|
from .object import Object
|
||||||
from .mixins import Hashable
|
from .mixins import Hashable
|
||||||
from .enums import ChannelType, VerificationLevel, try_enum
|
from .enums import ChannelType, VerificationLevel, InviteTarget, try_enum
|
||||||
|
|
||||||
__all__ = (
|
__all__ = (
|
||||||
'PartialInviteChannel',
|
'PartialInviteChannel',
|
||||||
@ -269,6 +269,14 @@ class Invite(Hashable):
|
|||||||
This includes idle, dnd, online, and invisible members. Offline members are excluded.
|
This includes idle, dnd, online, and invisible members. Offline members are excluded.
|
||||||
channel: Union[:class:`abc.GuildChannel`, :class:`Object`, :class:`PartialInviteChannel`]
|
channel: Union[:class:`abc.GuildChannel`, :class:`Object`, :class:`PartialInviteChannel`]
|
||||||
The channel the invite is for.
|
The channel the invite is for.
|
||||||
|
target_user: Optional[:class:`User`]
|
||||||
|
The target of this invite in the case of stream invites.
|
||||||
|
|
||||||
|
.. versionadded:: 2.0
|
||||||
|
target_type: :class:`InviteType`
|
||||||
|
The invite's target type.
|
||||||
|
|
||||||
|
.. versionadded:: 2.0
|
||||||
"""
|
"""
|
||||||
|
|
||||||
__slots__ = (
|
__slots__ = (
|
||||||
@ -282,6 +290,8 @@ class Invite(Hashable):
|
|||||||
'max_uses',
|
'max_uses',
|
||||||
'inviter',
|
'inviter',
|
||||||
'channel',
|
'channel',
|
||||||
|
'target_user',
|
||||||
|
'target_type',
|
||||||
'_state',
|
'_state',
|
||||||
'approximate_member_count',
|
'approximate_member_count',
|
||||||
'approximate_presence_count',
|
'approximate_presence_count',
|
||||||
@ -305,6 +315,9 @@ class Invite(Hashable):
|
|||||||
inviter_data = data.get('inviter')
|
inviter_data = data.get('inviter')
|
||||||
self.inviter = None if inviter_data is None else self._state.store_user(inviter_data)
|
self.inviter = None if inviter_data is None else self._state.store_user(inviter_data)
|
||||||
self.channel = data.get('channel')
|
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))
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def from_incomplete(cls, *, state, data):
|
def from_incomplete(cls, *, state, data):
|
||||||
|
18
docs/api.rst
18
docs/api.rst
@ -1952,6 +1952,24 @@ of :class:`enum.Enum`.
|
|||||||
|
|
||||||
Represents a sticker with a lottie image.
|
Represents a sticker with a lottie image.
|
||||||
|
|
||||||
|
.. class:: InviteTarget
|
||||||
|
|
||||||
|
Represents the type of target an invite contains.
|
||||||
|
|
||||||
|
.. versionadded:: 2.0
|
||||||
|
|
||||||
|
.. attribute:: unknown
|
||||||
|
|
||||||
|
The invite doesn't target anyone or anything.
|
||||||
|
|
||||||
|
.. attribute:: stream
|
||||||
|
|
||||||
|
The invite targets a stream.
|
||||||
|
|
||||||
|
.. attribute:: embedded_application
|
||||||
|
|
||||||
|
The invite targets an embedded application activity.
|
||||||
|
|
||||||
.. class:: VideoQualityMode
|
.. class:: VideoQualityMode
|
||||||
|
|
||||||
Represents the camera video quality mode for voice channel participants.
|
Represents the camera video quality mode for voice channel participants.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user