aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRapptz <[email protected]>2017-08-15 22:37:39 -0400
committerRapptz <[email protected]>2017-08-15 22:38:43 -0400
commit63231ef03396b31eadf20acac9ded942fdee523f (patch)
treebe740ef220e34a3e1c5434292d13229a2f572243
parentAdd delete_after to 'edit'. (diff)
downloaddiscord.py-63231ef03396b31eadf20acac9ded942fdee523f.tar.xz
discord.py-63231ef03396b31eadf20acac9ded942fdee523f.zip
Remove reason keyword argument from message deletion.
Apparently this is unsupported. Affected functions include: * abc.Messageable.send * Message.delete * TextChannel.delete_messages * TextChannel.purge
-rw-r--r--discord/abc.py7
-rw-r--r--discord/channel.py22
-rw-r--r--discord/message.py9
3 files changed, 13 insertions, 25 deletions
diff --git a/discord/abc.py b/discord/abc.py
index 143ca174..33a47171 100644
--- a/discord/abc.py
+++ b/discord/abc.py
@@ -628,7 +628,7 @@ class Messageable(metaclass=abc.ABCMeta):
raise NotImplementedError
@asyncio.coroutine
- def send(self, content=None, *, tts=False, embed=None, file=None, files=None, reason=None, delete_after=None, nonce=None):
+ def send(self, content=None, *, tts=False, embed=None, file=None, files=None, delete_after=None, nonce=None):
"""|coro|
Sends a message to the destination with the content given.
@@ -664,9 +664,6 @@ class Messageable(metaclass=abc.ABCMeta):
If provided, the number of seconds to wait in the background
before deleting the message we just sent. If the deletion fails,
then it is silently ignored.
- reason: Optional[str]
- The reason for deleting the message, if necessary.
- Shows up on the audit log.
Raises
--------
@@ -723,7 +720,7 @@ class Messageable(metaclass=abc.ABCMeta):
def delete():
yield from asyncio.sleep(delete_after, loop=state.loop)
try:
- yield from ret.delete(reason=reason)
+ yield from ret.delete()
except:
pass
compat.create_task(delete(), loop=state.loop)
diff --git a/discord/channel.py b/discord/channel.py
index 58559b34..14b55fe9 100644
--- a/discord/channel.py
+++ b/discord/channel.py
@@ -37,9 +37,9 @@ import asyncio
__all__ = ('TextChannel', 'VoiceChannel', 'DMChannel', 'GroupChannel', '_channel_factory')
@asyncio.coroutine
-def _single_delete_strategy(messages, *, reason):
+def _single_delete_strategy(messages):
for m in messages:
- yield from m.delete(reason=reason)
+ yield from m.delete()
class TextChannel(discord.abc.Messageable, discord.abc.GuildChannel, Hashable):
"""Represents a Discord guild text channel.
@@ -164,7 +164,7 @@ class TextChannel(discord.abc.Messageable, discord.abc.GuildChannel, Hashable):
self._update(self.guild, data)
@asyncio.coroutine
- def delete_messages(self, messages, *, reason=None):
+ def delete_messages(self, messages):
"""|coro|
Deletes a list of messages. This is similar to :meth:`Message.delete`
@@ -183,8 +183,6 @@ class TextChannel(discord.abc.Messageable, discord.abc.GuildChannel, Hashable):
-----------
messages: Iterable[:class:`abc.Snowflake`]
An iterable of messages denoting which ones to bulk delete.
- reason: Optional[str]
- The reason for bulk deleting these messages. Shows up on the audit log.
Raises
------
@@ -211,10 +209,10 @@ class TextChannel(discord.abc.Messageable, discord.abc.GuildChannel, Hashable):
raise ClientException('Can only bulk delete messages up to 100 messages')
message_ids = [m.id for m in messages]
- yield from self._state.http.delete_messages(self.id, message_ids, reason=reason)
+ yield from self._state.http.delete_messages(self.id, message_ids)
@asyncio.coroutine
- def purge(self, *, limit=100, check=None, before=None, after=None, around=None, reverse=False, reason=None, bulk=True):
+ def purge(self, *, limit=100, check=None, before=None, after=None, around=None, reverse=False, bulk=True):
"""|coro|
Purges a list of messages that meet the criteria given by the predicate
@@ -246,8 +244,6 @@ class TextChannel(discord.abc.Messageable, discord.abc.GuildChannel, Hashable):
Same as ``around`` in :meth:`history`.
reverse
Same as ``reverse`` in :meth:`history`.
- reason: Optional[str]
- The reason for doing this action. Shows up on the audit log.
bulk: bool
If True, use bulk delete. bulk=False is useful for mass-deleting
a bot's own messages without manage_messages. When True, will fall
@@ -296,17 +292,17 @@ class TextChannel(discord.abc.Messageable, discord.abc.GuildChannel, Hashable):
if count >= 2:
# more than 2 messages -> bulk delete
to_delete = ret[-count:]
- yield from strategy(to_delete, reason=reason)
+ yield from strategy(to_delete)
elif count == 1:
# delete a single message
- yield from ret[-1].delete(reason=reason)
+ yield from ret[-1].delete()
return ret
else:
if count == 100:
# we've reached a full 'queue'
to_delete = ret[-100:]
- yield from strategy(to_delete, reason=reason)
+ yield from strategy(to_delete)
count = 0
yield from asyncio.sleep(1)
@@ -317,7 +313,7 @@ class TextChannel(discord.abc.Messageable, discord.abc.GuildChannel, Hashable):
yield from ret[-1].delete()
elif count >= 2:
to_delete = ret[-count:]
- yield from strategy(to_delete, reason=reason)
+ yield from strategy(to_delete)
count = 0
strategy = _single_delete_strategy
diff --git a/discord/message.py b/discord/message.py
index 273da86a..e8bb4af2 100644
--- a/discord/message.py
+++ b/discord/message.py
@@ -475,7 +475,7 @@ class Message:
return '{0.author.name} started a call \N{EM DASH} Join the call.'.format(self)
@asyncio.coroutine
- def delete(self, *, reason=None):
+ def delete(self):
"""|coro|
Deletes the message.
@@ -484,11 +484,6 @@ class Message:
delete other people's messages, you need the :attr:`~Permissions.manage_messages`
permission.
- Parameters
- ------------
- reason: Optional[str]
- The reason for deleting this message. Shows up on the audit log.
-
Raises
------
Forbidden
@@ -496,7 +491,7 @@ class Message:
HTTPException
Deleting the message failed.
"""
- yield from self._state.http.delete_message(self.channel.id, self.id, reason=reason)
+ yield from self._state.http.delete_message(self.channel.id, self.id)
@asyncio.coroutine
def edit(self, **fields):