Skip to content

Commit 6d3e7ca

Browse files
authored
Merge branch 'development' into users/stephen/4-2-2-changelog
Signed-off-by: Stephen <48072084+StephenDaDev@users.noreply.github.com>
2 parents e8f1413 + 5d4175e commit 6d3e7ca

1 file changed

Lines changed: 21 additions & 8 deletions

File tree

core/thread.py

Lines changed: 21 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2664,14 +2664,27 @@ async def create(
26642664
self.bot.config["confirm_thread_creation_deny"],
26652665
)
26662666
)
2667-
confirm = await destination.send(
2668-
embed=discord.Embed(
2669-
title=self.bot.config["confirm_thread_creation_title"],
2670-
description=self.bot.config["confirm_thread_response"],
2671-
color=self.bot.main_color,
2672-
),
2673-
view=view,
2674-
)
2667+
try:
2668+
confirm = await destination.send(
2669+
embed=discord.Embed(
2670+
title=self.bot.config["confirm_thread_creation_title"],
2671+
description=self.bot.config["confirm_thread_response"],
2672+
color=self.bot.main_color,
2673+
),
2674+
view=view,
2675+
)
2676+
except discord.Forbidden:
2677+
# Recipient has DMs disabled (or otherwise unreachable). Without this,
2678+
# the thread would stay stuck in cache in a "not ready" state until a
2679+
# bot restart, since view.wait() below would never run.
2680+
logger.warning(
2681+
"Could not send confirm-thread-creation message to %s, DMs are likely disabled.",
2682+
recipient,
2683+
)
2684+
thread.cancelled = True
2685+
del self.cache[recipient.id]
2686+
return thread
2687+
26752688
await view.wait()
26762689
if view.value is None:
26772690
thread.cancelled = True

0 commit comments

Comments
 (0)