From f24290c4232efff32980773b9354ebc0a32a4afb Mon Sep 17 00:00:00 2001 From: aikaterna <20862007+aikaterna@users.noreply.github.com> Date: Tue, 24 Jul 2018 17:39:51 -0700 Subject: [PATCH] [V3 Help] Exception for help when bot is blocked (#1955) Fix for #1901. Administrative merge: Travis CI failed due to docs issue, see #1957 --- redbot/core/help_formatter.py | 32 ++++++++++++++++++-------------- 1 file changed, 18 insertions(+), 14 deletions(-) diff --git a/redbot/core/help_formatter.py b/redbot/core/help_formatter.py index ab50bfd3a..397a191ed 100644 --- a/redbot/core/help_formatter.py +++ b/redbot/core/help_formatter.py @@ -407,20 +407,24 @@ async def help(ctx, *cmds: str): max_pages_in_guild = await ctx.bot.db.help.max_pages_in_guild() if len(embeds) > max_pages_in_guild: destination = ctx.author - - for embed in embeds: - if use_embeds: - try: - await destination.send(embed=embed) - except discord.HTTPException: - destination = ctx.author - await destination.send(embed=embed) - else: - try: - await destination.send(embed) - except discord.HTTPException: - destination = ctx.author - await destination.send(embed) + try: + for embed in embeds: + if use_embeds: + try: + await destination.send(embed=embed) + except discord.HTTPException: + destination = ctx.author + await destination.send(embed=embed) + else: + try: + await destination.send(embed) + except discord.HTTPException: + destination = ctx.author + await destination.send(embed) + except discord.Forbidden: + await ctx.channel.send( + "I couldn't send the help message to you in DM. Either you blocked me or you disabled DMs in this server." + ) @help.error