aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--bot/exts/help_channels/_cog.py18
1 files changed, 17 insertions, 1 deletions
diff --git a/bot/exts/help_channels/_cog.py b/bot/exts/help_channels/_cog.py
index 7fb72d7ef..a9b847582 100644
--- a/bot/exts/help_channels/_cog.py
+++ b/bot/exts/help_channels/_cog.py
@@ -12,6 +12,7 @@ from discord.ext import commands
from bot import constants
from bot.bot import Bot
+from bot.constants import Channels, RedirectOutput
from bot.exts.help_channels import _caches, _channel, _message, _name, _stats
from bot.utils import channel as channel_utils, lock, scheduling
@@ -580,7 +581,22 @@ class HelpChannels(commands.Cog):
timestamp=message.created_at
)
embed.add_field(name="Conversation", value=f"[Jump to message]({message.jump_url})")
- await message.author.send(embed=embed)
+
+ try:
+ await message.author.send(embed=embed)
+ except discord.Forbidden:
+ log.trace(
+ f"Failed to send helpdm message to {message.author.id}. DMs Closed/Blocked. "
+ "Removing user from helpdm."
+ )
+ bot_commands_channel = self.bot.get_channel(Channels.bot_commands)
+ await _caches.help_dm.delete(message.author.id)
+ await bot_commands_channel.send(
+ f"{message.author.mention} {constants.Emojis.cross_mark} "
+ "To receive updates on help channels you're active in, enable your DMs.",
+ delete_after=RedirectOutput.delete_after
+ )
+ return
await _caches.session_participants.set(
message.channel.id,