Skip to content

Commit

Permalink
Merge branch 'main' into swfarnsworth/help_channel_message
Browse files Browse the repository at this point in the history
  • Loading branch information
Akarys42 authored Jun 16, 2021
2 parents 211b228 + 2e7a0ba commit 1e8715b
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion bot/exts/help_channels/_cog.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

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

Expand Down Expand Up @@ -580,7 +581,22 @@ async def notify_session_participants(self, message: discord.Message) -> None:
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,
Expand Down

0 comments on commit 1e8715b

Please sign in to comment.