aboutsummaryrefslogtreecommitdiff
path: root/discord/guild.py
diff options
context:
space:
mode:
authorRapptz <[email protected]>2021-05-09 22:23:21 -0400
committerRapptz <[email protected]>2021-06-08 07:29:17 -0400
commitbd369c76ea5424f65e37d84bfb45df1c76a4e739 (patch)
tree435f8a36703721a4ef74ef0a4682dd5dd8655a3c /discord/guild.py
parentAdd ThreadMember.thread (diff)
downloaddiscord.py-bd369c76ea5424f65e37d84bfb45df1c76a4e739.tar.xz
discord.py-bd369c76ea5424f65e37d84bfb45df1c76a4e739.zip
Parse remaining thread events.
Diffstat (limited to 'discord/guild.py')
-rw-r--r--discord/guild.py16
1 files changed, 15 insertions, 1 deletions
diff --git a/discord/guild.py b/discord/guild.py
index 4e7e38f6..e32c2fcf 100644
--- a/discord/guild.py
+++ b/discord/guild.py
@@ -26,7 +26,7 @@ from __future__ import annotations
import copy
from collections import namedtuple
-from typing import Dict, List, Literal, Optional, TYPE_CHECKING, Union, overload
+from typing import Dict, List, Set, Literal, Optional, TYPE_CHECKING, Union, overload
from . import utils, abc
from .role import Role
@@ -227,6 +227,20 @@ class Guild(Hashable):
def _remove_thread(self, thread):
self._threads.pop(thread.id, None)
+ def _clear_threads(self):
+ self._threads.clear()
+
+ def _remove_threads_by_channel(self, channel_id: int):
+ to_remove = [k for k, t in self._threads.items() if t.parent_id == channel_id]
+ for k in to_remove:
+ del self._threads[k]
+
+ def _filter_threads(self, channel_ids: Set[int]) -> Dict[int, Thread]:
+ to_remove: Dict[int, Thread] = {k: t for k, t in self._threads.items() if t.parent_id in channel_ids}
+ for k in to_remove:
+ del self._threads[k]
+ return to_remove
+
def __str__(self):
return self.name or ''