Skip to content

Commit

Permalink
Merge branch 'Pycord-Development:master' into disable-view
Browse files Browse the repository at this point in the history
  • Loading branch information
27Saumya authored Apr 12, 2022
2 parents 981a326 + a3e1dd0 commit be46a6e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
6 changes: 5 additions & 1 deletion discord/ext/pages/pagination.py
Original file line number Diff line number Diff line change
Expand Up @@ -756,7 +756,8 @@ async def send(
target_message: Optional[str] = None,
reference: Optional[Union[discord.Message, discord.MessageReference, discord.PartialMessage]] = None,
allowed_mentions: Optional[discord.AllowedMentions] = None,
mention_author: bool = None,
mention_author: Optional[bool] = None,
delete_after: Optional[float] = None,
) -> discord.Message:
"""Sends a message with the paginated items.
Expand All @@ -782,6 +783,8 @@ async def send(
are used instead.
mention_author: Optional[:class:`bool`]
If set, overrides the :attr:`~discord.AllowedMentions.replied_user` attribute of ``allowed_mentions``.
delete_after: Optional[:class:`float`]
If set, deletes the paginator after the specified time.
Returns
--------
Expand Down Expand Up @@ -831,6 +834,7 @@ async def send(
reference=reference,
allowed_mentions=allowed_mentions,
mention_author=mention_author,
delete_after=delete_after,
)

return self.message
Expand Down
8 changes: 5 additions & 3 deletions discord/threads.py
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,7 @@ def permissions_for(self, obj: Union[Member, Role], /) -> Permissions:
raise ClientException("Parent channel not found")
return parent.permissions_for(obj)

async def delete_messages(self, messages: Iterable[Snowflake]) -> None:
async def delete_messages(self, messages: Iterable[Snowflake], *, reason: Optional[str] = None) -> None:
"""|coro|
Deletes a list of messages. This is similar to :meth:`Message.delete`
Expand All @@ -373,6 +373,8 @@ async def delete_messages(self, messages: Iterable[Snowflake]) -> None:
-----------
messages: Iterable[:class:`abc.Snowflake`]
An iterable of messages denoting which ones to bulk delete.
reason: Optional[:class:`str`]
The reason for deleting the messages. Shows up on the audit log.
Raises
------
Expand All @@ -394,14 +396,14 @@ async def delete_messages(self, messages: Iterable[Snowflake]) -> None:

if len(messages) == 1:
message_id = messages[0].id
await self._state.http.delete_message(self.id, message_id)
await self._state.http.delete_message(self.id, message_id, reason=reason)
return

if len(messages) > 100:
raise ClientException("Can only bulk delete messages up to 100 messages")

message_ids: SnowflakeList = [m.id for m in messages]
await self._state.http.delete_messages(self.id, message_ids)
await self._state.http.delete_messages(self.id, message_ids, reason=reason)

async def purge(
self,
Expand Down

0 comments on commit be46a6e

Please sign in to comment.