aboutsummaryrefslogtreecommitdiff
path: root/discord/state.py
diff options
context:
space:
mode:
authorRapptz <[email protected]>2021-05-09 23:35:48 -0400
committerRapptz <[email protected]>2021-06-08 07:29:17 -0400
commite13cbf46447cf149da54d01562c11a1786f9ebef (patch)
treee7a5bfcf1d78ef7280d638577826c3b5ee243494 /discord/state.py
parentParse remaining thread events. (diff)
downloaddiscord.py-e13cbf46447cf149da54d01562c11a1786f9ebef.tar.xz
discord.py-e13cbf46447cf149da54d01562c11a1786f9ebef.zip
Don't dispatch thread_join on extraneous THREAD_CREATE dispatches
Diffstat (limited to 'discord/state.py')
-rw-r--r--discord/state.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/discord/state.py b/discord/state.py
index d8c322ac..ec93590b 100644
--- a/discord/state.py
+++ b/discord/state.py
@@ -709,14 +709,16 @@ class ConnectionState:
def parse_thread_create(self, data):
guild_id = int(data['guild_id'])
- guild = self._get_guild(guild_id)
+ guild: Optional[Guild] = self._get_guild(guild_id)
if guild is None:
log.debug('THREAD_CREATE referencing an unknown guild ID: %s. Discarding', guild_id)
return
thread = Thread(guild=guild, data=data)
+ has_thread = guild.get_thread(thread.id)
guild._add_thread(thread)
- self.dispatch('thread_join', thread)
+ if not has_thread:
+ self.dispatch('thread_join', thread)
def parse_thread_update(self, data):
guild_id = int(data['guild_id'])