Skip to content

Commit 986b744

Browse files
committed
Remove searching through message history to find threads
1 parent 043fd5a commit 986b744

File tree

1 file changed

+2
-19
lines changed

1 file changed

+2
-19
lines changed

core/thread.py

Lines changed: 2 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -735,7 +735,7 @@ async def find(
735735
) -> Thread:
736736
"""Finds a thread from cache or from discord channel topics."""
737737
if recipient is None and channel is not None:
738-
return await self._find_from_channel(channel)
738+
return self._find_from_channel(channel)
739739

740740
thread = None
741741

@@ -761,7 +761,7 @@ async def find(
761761
thread.ready = True
762762
return thread
763763

764-
async def _find_from_channel(self, channel):
764+
def _find_from_channel(self, channel):
765765
"""
766766
Tries to find a thread from a channel channel topic,
767767
if channel topic doesnt exist for some reason, falls back to
@@ -773,23 +773,6 @@ async def _find_from_channel(self, channel):
773773
if channel.topic:
774774
user_id = match_user_id(channel.topic)
775775

776-
# BUG: When discord fails to create channel topic.
777-
# search through message history
778-
elif channel.topic is None:
779-
try:
780-
async for message in channel.history(limit=100):
781-
if message.author != self.bot.user:
782-
continue
783-
if message.embeds:
784-
embed = message.embeds[0]
785-
if embed.footer.text:
786-
user_id = match_user_id(embed.footer.text)
787-
if user_id != -1:
788-
break
789-
except discord.NotFound:
790-
# When the channel's deleted.
791-
pass
792-
793776
if user_id != -1:
794777
if user_id in self.cache:
795778
return self.cache[user_id]

0 commit comments

Comments
 (0)