Skip to content

Commit d81e67b

Browse files
committed
3.8.4 - Another fix attempt
1 parent 308d669 commit d81e67b

File tree

3 files changed

+9
-5
lines changed

3 files changed

+9
-5
lines changed

CHANGELOG.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
66
This project mostly adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html);
77
however, insignificant breaking changes do not guarantee a major version bump, see the reasoning [here](https://github.com/kyb3r/modmail/issues/319). If you're a plugin developer, note the "BREAKING" section.
88

9-
# v3.8.3
9+
# v3.8.4
1010

1111
This update is a quick hotfix for a weird behaviour experienced on 1 Feb 2021 where users were not properly cached.
1212

bot.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
__version__ = "3.8.3"
1+
__version__ = "3.8.4"
22

33

44
import asyncio

core/thread.py

+7-3
Original file line numberDiff line numberDiff line change
@@ -1092,7 +1092,7 @@ async def find(
10921092
) -> typing.Optional[Thread]:
10931093
"""Finds a thread from cache or from discord channel topics."""
10941094
if recipient is None and channel is not None:
1095-
thread = self._find_from_channel(channel)
1095+
thread = await self._find_from_channel(channel)
10961096
if thread is None:
10971097
user_id, thread = next(
10981098
((k, v) for k, v in self.cache.items() if v.channel == channel), (-1, None)
@@ -1133,7 +1133,7 @@ async def find(
11331133
thread.ready = True
11341134
return thread
11351135

1136-
def _find_from_channel(self, channel):
1136+
async def _find_from_channel(self, channel):
11371137
"""
11381138
Tries to find a thread from a channel channel topic,
11391139
if channel topic doesnt exist for some reason, falls back to
@@ -1151,7 +1151,11 @@ def _find_from_channel(self, channel):
11511151
if user_id in self.cache:
11521152
return self.cache[user_id]
11531153

1154-
recipient = self.bot.get_user(user_id)
1154+
try:
1155+
recipient = self.bot.get_user(user_id) or await self.bot.fetch_user(user_id)
1156+
except discord.NotFound:
1157+
recipient = None
1158+
11551159
if recipient is None:
11561160
self.cache[user_id] = thread = Thread(self, user_id, channel)
11571161
else:

0 commit comments

Comments
 (0)