mirror of
https://github.com/Rapptz/discord.py.git
synced 2025-04-21 16:24:14 +00:00
Fix bug with deleting private messages.
This was due to an AttributeError occurring when getting the guild_id from the channel. PrivateChannels do not have guild_ids so they should be None.
This commit is contained in:
parent
324d10c9d9
commit
c3c9db7777
@ -911,7 +911,8 @@ class Client:
|
||||
Deleting the message failed.
|
||||
"""
|
||||
channel = message.channel
|
||||
yield from self.http.delete_message(channel.id, message.id, channel.server.id)
|
||||
guild_id = channel.server.id if not getattr(channel, 'is_private', True) else None
|
||||
yield from self.http.delete_message(channel.id, message.id, guild_id)
|
||||
|
||||
@asyncio.coroutine
|
||||
def delete_messages(self, messages):
|
||||
@ -949,7 +950,8 @@ class Client:
|
||||
|
||||
channel = messages[0].channel
|
||||
message_ids = [m.id for m in messages]
|
||||
yield from self.http.delete_messages(channel.id, message_ids, channel.server.id)
|
||||
guild_id = channel.server.id if not getattr(channel, 'is_private', True) else None
|
||||
yield from self.http.delete_messages(channel.id, message_ids, guild_id)
|
||||
|
||||
@asyncio.coroutine
|
||||
def purge_from(self, channel, *, limit=100, check=None, before=None, after=None):
|
||||
@ -1073,7 +1075,7 @@ class Client:
|
||||
|
||||
channel = message.channel
|
||||
content = str(new_content)
|
||||
guild_id = channel.server.id if not channel.is_private else None
|
||||
guild_id = channel.server.id if not getattr(channel, 'is_private', True) else None
|
||||
data = yield from self.http.edit_message(message.id, channel.id, content, guild_id=guild_id)
|
||||
return Message(channel=channel, **data)
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user