[V3 Help] Exception for help when bot is blocked (#1955)

Fix for #1901.
Administrative merge: Travis CI failed due to docs issue, see #1957
This commit is contained in:
aikaterna 2018-07-24 17:39:51 -07:00 committed by Kowlin
parent f8a36885fe
commit f24290c423

View File

@ -407,20 +407,24 @@ async def help(ctx, *cmds: str):
max_pages_in_guild = await ctx.bot.db.help.max_pages_in_guild() max_pages_in_guild = await ctx.bot.db.help.max_pages_in_guild()
if len(embeds) > max_pages_in_guild: if len(embeds) > max_pages_in_guild:
destination = ctx.author destination = ctx.author
try:
for embed in embeds: for embed in embeds:
if use_embeds: if use_embeds:
try: try:
await destination.send(embed=embed) await destination.send(embed=embed)
except discord.HTTPException: except discord.HTTPException:
destination = ctx.author destination = ctx.author
await destination.send(embed=embed) await destination.send(embed=embed)
else: else:
try: try:
await destination.send(embed) await destination.send(embed)
except discord.HTTPException: except discord.HTTPException:
destination = ctx.author destination = ctx.author
await destination.send(embed) 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 @help.error