[V3 Context] make send_help respect embed setting (#1723)

This commit is contained in:
palmtree5 2018-05-27 20:37:58 -08:00 committed by Kowlin
parent 971ccf9df4
commit 179883094e

View File

@ -30,9 +30,16 @@ class Context(commands.Context):
""" """
command = self.invoked_subcommand or self.command command = self.invoked_subcommand or self.command
embeds = await self.bot.formatter.format_help_for(self, command) embed_wanted = await self.bot.embed_requested(
destination = self self.channel, self.author, command=self.bot.get_command("help")
)
if self.guild and not self.channel.permissions_for(self.guild.me).embed_links:
embed_wanted = False
ret = [] ret = []
destination = self
if embed_wanted:
embeds = await self.bot.formatter.format_help_for(self, command)
for embed in embeds: for embed in embeds:
try: try:
m = await destination.send(embed=embed) m = await destination.send(embed=embed)
@ -40,6 +47,16 @@ class Context(commands.Context):
destination = self.author destination = self.author
m = await destination.send(embed=embed) m = await destination.send(embed=embed)
ret.append(m) ret.append(m)
else:
f = commands.HelpFormatter()
msgs = await f.format_help_for(self, command)
for msg in msgs:
try:
m = await destination.send(msg)
except discord.HTTPException:
destination = self.author
m = await destination.send(msg)
ret.append(m)
return ret return ret