@@ -1710,17 +1710,33 @@ async def fetch_message(self, id: int, /) -> Message:
17101710 data = await self ._state .http .get_message (channel .id , id )
17111711 return self ._state .create_message (channel = channel , data = data )
17121712
1713- async def pins (self ) -> List [Message ]:
1713+ async def pins (self , * , before : Optional [ SnowflakeTime ] = None , limit : Optional [ int ] = None ) -> List [Message ]:
17141714 """|coro|
17151715
1716- Retrieves all messages that are currently pinned in the channel.
1716+ Retrieves a maximum of 50 pinned messages from the destination.
1717+
1718+ Requires the :attr:`~discord.Permissions.view_channel` permission.
1719+
1720+ No pins will be returned if the user is missing the
1721+ :attr:`~discord.Permissions.read_message_history` permission.
17171722
17181723 .. note::
17191724
17201725 Due to a limitation with the Discord API, the :class:`.Message`
17211726 objects returned by this method do not contain complete
17221727 :attr:`.Message.reactions` data.
17231728
1729+ Parameters
1730+ -----------
1731+ before: Optional[Union[:class:`~discord.abc.Snowflake`, :class:`datetime.datetime`]]
1732+ Retrieve pinned messages before this date or message.
1733+ If a datetime is provided, it is recommended to use a UTC aware datetime.
1734+ If the datetime is naive, it is assumed to be local time.
1735+ limit: Optional[int]
1736+ The maximum number of pinned messages to retrieve. Defaults to 50.
1737+
1738+ This must be a number between 1 and 50.
1739+
17241740 Raises
17251741 -------
17261742 ~discord.Forbidden
@@ -1733,11 +1749,13 @@ async def pins(self) -> List[Message]:
17331749 List[:class:`~discord.Message`]
17341750 The messages that are currently pinned.
17351751 """
1752+ if isinstance (before , datetime ):
1753+ before = Object (id = utils .time_snowflake (before , high = False ))
17361754
17371755 channel = await self ._get_channel ()
17381756 state = self ._state
1739- data = await state .http .pins_from (channel .id )
1740- return [state .create_message (channel = channel , data = m ) for m in data ]
1757+ data = await state .http .pins_from (channel .id , before = before . id if before else None , limit = limit )
1758+ return [state .create_message (channel = channel , data = m [ "message" ] ) for m in data [ "items" ] ]
17411759
17421760 async def history (
17431761 self ,
0 commit comments