diff options
| author | 2021-06-16 13:28:06 +0200 | |
|---|---|---|
| committer | 2021-06-16 13:28:06 +0200 | |
| commit | 2e7a0baa7b5f7d1e5b3a914c2530f9be3008054b (patch) | |
| tree | ad6d8cc2d4deb3a9ea4fa92137f907c281c9ecf8 | |
| parent | Merge pull request #1639 from python-discord/poll-for-partners (diff) | |
| parent | Update bot/exts/help_channels/_cog.py (diff) | |
Merge pull request #1642 from FaresAhmedb/#1640
Fix helpdm couldn't DM the user
Diffstat (limited to '')
| -rw-r--r-- | bot/exts/help_channels/_cog.py | 18 | 
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,  |