From 0db7b227131664f0086780580acf0862f69ac005 Mon Sep 17 00:00:00 2001 From: "I. Ahmad" <54180221+nerdguyahmad@users.noreply.github.com> Date: Wed, 9 Mar 2022 07:16:46 +0500 Subject: [PATCH] Fix archived threads not getting evicted Fixes #7541 --- discord/state.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/discord/state.py b/discord/state.py index ef61471ab..8a7bcff86 100644 --- a/discord/state.py +++ b/discord/state.py @@ -857,10 +857,13 @@ class ConnectionState: if thread is not None: old = copy.copy(thread) thread._update(data) + if thread.archived: + guild._remove_thread(thread) self.dispatch('thread_update', old, thread) else: thread = Thread(guild=guild, state=guild._state, data=data) - guild._add_thread(thread) + if not thread.archived: + guild._add_thread(thread) self.dispatch('thread_join', thread) def parse_thread_delete(self, data: gw.ThreadDeleteEvent) -> None: