@@ -1710,7 +1710,7 @@ 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 , * , before : Optional [SnowflakeTime ] = None , limit : Optional [int ] = None ) -> List [Message ]:
1713+ async def pins (self , * , before : Optional [datetime ] = None , limit : Optional [int ] = None ) -> List [Message ]:
17141714 """|coro|
17151715
17161716 Retrieves a maximum of 50 pinned messages from the destination.
@@ -1728,8 +1728,8 @@ async def pins(self, *, before: Optional[SnowflakeTime] = None, limit: Optional[
17281728
17291729 Parameters
17301730 -----------
1731- before: Optional[Union[ :class:`~discord.abc.Snowflake`, :class:` datetime.datetime`] ]
1732- Retrieve pinned messages before this date or message .
1731+ before: Optional[:class:`datetime.datetime`]
1732+ Retrieve pinned messages before this time .
17331733 If a datetime is provided, it is recommended to use a UTC aware datetime.
17341734 If the datetime is naive, it is assumed to be local time.
17351735 limit: Optional[int]
@@ -1749,13 +1749,17 @@ async def pins(self, *, before: Optional[SnowflakeTime] = None, limit: Optional[
17491749 List[:class:`~discord.Message`]
17501750 The messages that are currently pinned.
17511751 """
1752- if isinstance (before , datetime ):
1753- before = Object (id = utils .time_snowflake (before , high = False ))
1752+ state = self ._state
1753+ if before is not None :
1754+ if not isinstance (before , datetime ):
1755+ raise TypeError (f'before must be a datetime object, not { before .__class__ !r} ' )
1756+ if before .tzinfo is None :
1757+ raise TypeError (
1758+ 'before must be an aware datetime. Consider using discord.utils.utcnow() or datetime.datetime.now().astimezone() for local time.'
1759+ )
17541760
17551761 channel = await self ._get_channel ()
1756- state = self ._state
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" ]]
1762+ data = await state .http .pins_from (channel .id , before = before .isoformat () if before else None , limit = limit )
17591763
17601764 async def history (
17611765 self ,
0 commit comments