mirror of
https://github.com/Rapptz/discord.py.git
synced 2025-09-07 18:33:02 +00:00
Redesign bulk delete events
Change `parse_message_delete_bulk` to not dispatch individual `message_delete` events, and instead `bulk_message_delete`. Also make `raw_bulk_message` delete and `raw_message_delete` have message objects attached. Fixes #1807
This commit is contained in:
@ -35,14 +35,16 @@ class RawMessageDeleteEvent:
|
||||
The guild ID where the deletion took place, if applicable.
|
||||
message_id: :class:`int`
|
||||
The message ID that got deleted.
|
||||
cached_message: Optional[:class:`Message`]
|
||||
The cached message, if found in the internal message cache.
|
||||
"""
|
||||
|
||||
__slots__ = ('message_id', 'channel_id', 'guild_id')
|
||||
__slots__ = ('message_id', 'channel_id', 'guild_id', 'cached_message')
|
||||
|
||||
def __init__(self, data):
|
||||
self.message_id = int(data['id'])
|
||||
self.channel_id = int(data['channel_id'])
|
||||
|
||||
self.cached_message = None
|
||||
try:
|
||||
self.guild_id = int(data['guild_id'])
|
||||
except KeyError:
|
||||
@ -59,13 +61,16 @@ class RawBulkMessageDeleteEvent:
|
||||
The channel ID where the message got deleted.
|
||||
guild_id: Optional[:class:`int`]
|
||||
The guild ID where the message got deleted, if applicable.
|
||||
cached_messages: List[:class:`Message`]
|
||||
The cached messages, if found in the internal message cache.
|
||||
"""
|
||||
|
||||
__slots__ = ('message_ids', 'channel_id', 'guild_id')
|
||||
__slots__ = ('message_ids', 'channel_id', 'guild_id', 'cached_messages')
|
||||
|
||||
def __init__(self, data):
|
||||
self.message_ids = {int(x) for x in data.get('ids', [])}
|
||||
self.channel_id = int(data['channel_id'])
|
||||
self.cached_messages = []
|
||||
|
||||
try:
|
||||
self.guild_id = int(data['guild_id'])
|
||||
|
Reference in New Issue
Block a user