Browse Source

Small forgotten things

pull/10109/head
dolfies 3 years ago
parent
commit
887e83de90
  1. 13
      discord/abc.py
  2. 25
      discord/channel.py
  3. 7
      discord/http.py

13
discord/abc.py

@ -1500,6 +1500,19 @@ class Messageable:
data = await self._state.http.get_message(channel.id, id)
return self._state.create_message(channel=channel, data=data)
async def ack_pins(self) -> None:
"""|coro|
Acks the channel's pins.
Raises
-------
~discord.HTTPException
Acking the pinned messages failed.
"""
channel = await self._get_channel()
await self._state.http.ack_pins(channel.id)
async def pins(self) -> List[Message]:
"""|coro|

25
discord/channel.py

@ -54,6 +54,7 @@ from .errors import ClientException, InvalidArgument
from .stage_instance import StageInstance
from .threads import Thread
from .iterators import ArchivedThreadIterator
from .invite import Invite
__all__ = (
'TextChannel',
@ -2100,6 +2101,30 @@ class GroupChannel(discord.abc.Messageable, discord.abc.Connectable, Hashable):
"""
await self._state.http.delete_channel(self.id)
async def create_invite(self, *, max_age: int = 86400) -> Invite:
"""|coro|
Creates an instant invite from a group channel.
Parameters
------------
max_age: :class:`int`
How long the invite should last in seconds.
Defaults to 86400. Does not support 0.
Raises
-------
~discord.HTTPException
Invite creation failed.
Returns
--------
:class:`~discord.Invite`
The invite that was created.
"""
data = await self._state.http.create_group_invite(self.id, max_age=max_age)
return Invite.from_incomplete(data=data, state=self._state)
class PartialMessageable(discord.abc.Messageable, Hashable):
"""Represents a partial messageable to aid with working messageable channels when

7
discord/http.py

@ -1546,12 +1546,7 @@ class HTTPClient:
return self.request(r, reason=reason, json=payload)
def create_group_invite(
self,
channel_id: Snowflake,
*,
max_age: int = 86400,
) -> Response[invite.Invite]:
def create_group_invite(self, channel_id: Snowflake, *, max_age: int = 86400) -> Response[invite.Invite]:
payload = {
'max_age': max_age,
}

Loading…
Cancel
Save