mirror of
https://github.com/Cog-Creators/Red-DiscordBot.git
synced 2025-12-06 09:22:31 -05:00
Make embeds in help output consistent (#5452)
* Add `check_permissions` kwarg to `bot.embed_requested()` * Make embeds in help consistent regardless of why it's being sent
This commit is contained in:
@@ -358,7 +358,7 @@ class RedHelpFormatter(HelpFormatterABC):
|
||||
grp = cast(commands.Group, command)
|
||||
subcommands = await self.get_group_help_mapping(ctx, grp, help_settings=help_settings)
|
||||
|
||||
if await ctx.embed_requested():
|
||||
if await self.embed_requested(ctx):
|
||||
emb = {"embed": {"title": "", "description": ""}, "footer": {"text": ""}, "fields": []}
|
||||
|
||||
if description:
|
||||
@@ -539,7 +539,7 @@ class RedHelpFormatter(HelpFormatterABC):
|
||||
description = obj.format_help_for_context(ctx)
|
||||
tagline = (help_settings.tagline) or self.get_default_tagline(ctx)
|
||||
|
||||
if await ctx.embed_requested():
|
||||
if await self.embed_requested(ctx):
|
||||
emb = {"embed": {"title": "", "description": ""}, "footer": {"text": ""}, "fields": []}
|
||||
|
||||
emb["footer"]["text"] = tagline
|
||||
@@ -606,7 +606,7 @@ class RedHelpFormatter(HelpFormatterABC):
|
||||
description = ctx.bot.description or ""
|
||||
tagline = (help_settings.tagline) or self.get_default_tagline(ctx)
|
||||
|
||||
if await ctx.embed_requested():
|
||||
if await self.embed_requested(ctx):
|
||||
|
||||
emb = {"embed": {"title": "", "description": ""}, "footer": {"text": ""}, "fields": []}
|
||||
|
||||
@@ -705,6 +705,11 @@ class RedHelpFormatter(HelpFormatterABC):
|
||||
else:
|
||||
yield obj
|
||||
|
||||
async def embed_requested(self, ctx: Context) -> bool:
|
||||
return await ctx.bot.embed_requested(
|
||||
channel=ctx.channel, user=ctx.author, command=red_help, check_permissions=True
|
||||
)
|
||||
|
||||
async def command_not_found(self, ctx, help_for, help_settings: HelpSettings):
|
||||
"""
|
||||
Sends an error, fuzzy help, or stays quiet based on settings
|
||||
@@ -717,7 +722,7 @@ class RedHelpFormatter(HelpFormatterABC):
|
||||
),
|
||||
min_score=75,
|
||||
)
|
||||
use_embeds = await ctx.embed_requested()
|
||||
use_embeds = await self.embed_requested(ctx)
|
||||
if fuzzy_commands:
|
||||
ret = await format_fuzzy_results(ctx, fuzzy_commands, embed=use_embeds)
|
||||
if use_embeds:
|
||||
@@ -751,7 +756,7 @@ class RedHelpFormatter(HelpFormatterABC):
|
||||
ret = _("Command *{command_name}* has no subcommand named *{not_found}*.").format(
|
||||
command_name=command.qualified_name, not_found=not_found[0]
|
||||
)
|
||||
if await ctx.embed_requested():
|
||||
if await self.embed_requested(ctx):
|
||||
ret = discord.Embed(color=(await ctx.embed_color()), description=ret)
|
||||
ret.set_author(
|
||||
name=_("{ctx.me.display_name} Help Menu").format(ctx=ctx),
|
||||
|
||||
Reference in New Issue
Block a user