mirror of
https://github.com/Rapptz/discord.py.git
synced 2025-09-07 10:22:59 +00:00
Fix channel deletion not removing associated threads
This commit is contained in:
committed by
GitHub
parent
0b4263e697
commit
0ee1794c6d
@ -33,6 +33,8 @@ from .app_commands import AppCommandPermissions
|
||||
from .colour import Colour
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from typing_extensions import Self
|
||||
|
||||
from .types.gateway import (
|
||||
MessageDeleteEvent,
|
||||
MessageDeleteBulkEvent as BulkMessageDeleteEvent,
|
||||
@ -399,6 +401,20 @@ class RawThreadDeleteEvent(_RawReprMixin):
|
||||
self.parent_id: int = int(data['parent_id'])
|
||||
self.thread: Optional[Thread] = None
|
||||
|
||||
@classmethod
|
||||
def _from_thread(cls, thread: Thread) -> Self:
|
||||
data: ThreadDeleteEvent = {
|
||||
'id': thread.id,
|
||||
'type': thread.type.value,
|
||||
'guild_id': thread.guild.id,
|
||||
'parent_id': thread.parent_id,
|
||||
}
|
||||
|
||||
instance = cls(data)
|
||||
instance.thread = thread
|
||||
|
||||
return instance
|
||||
|
||||
|
||||
class RawThreadMembersUpdate(_RawReprMixin):
|
||||
"""Represents the payload for a :func:`on_raw_thread_member_remove` event.
|
||||
|
Reference in New Issue
Block a user