Add support for creating parties #35

Open
wasi-master wants to merge 2 commits from wasi-master/2.0 into 2.0
4 changed files with 137 additions and 1 deletions
Showing only changes of commit 30da1159e1 - Show all commits

View File

@ -2071,7 +2071,50 @@ class PartialMessageable(discord.abc.Messageable, Hashable):
return PartialMessage(channel=self, id=message_id)
class Party:
"""Represents a party in a voice channel."""
"""Represents a party in a voice channel.
.. container:: operations
.. describe:: x == y
Checks if two party are equal.
.. describe:: x != y
Checks if two party are not equal.
.. describe:: hash(x)
Returns the party hash.
.. describe:: str(x)
Returns the party URL.
Attributes
-----------
code: :class:`str`
The URL fragment used for the party.
uses: :class:`int`
How many times the invite has been used.
max_uses: :class:`int`
How many times the invite can be used.
A value of ``0`` indicates that it has unlimited uses.
max_age: :class:`int`
How long before the party expires in seconds.
A value of ``0`` indicates that it doesn't expire.
temporary: :class:`bool`
Indicates that the invite grants temporary membership.
If ``True``, members who joined via this invite will be kicked upon disconnect.
created_at: :class:`datetime.datetime`
An aware UTC datetime object denoting the time the invite was created.
Note
----
Parties are still in BETA so there are some limitations.
Currently this BETA feature is only supported on web and updated PC app versions of Discord and is not supported on mobile.
First someone has to to click the blue link itself and not the join button, then everyone else can click the join button normally.
"""
__slots__ = ('code', 'uses', 'max_uses', 'max_age', 'temporary', 'created_at')
@ -2090,6 +2133,9 @@ class Party:
def __str__(self):
return f'https://discord.gg/{self.code}'
def __hash__(self) -> int:
return hash(self.code)
def __eq__(self, other):
return isinstance(other, Party) and self.code == other.code