mirror of
https://github.com/Cog-Creators/Red-DiscordBot.git
synced 2025-11-06 03:08:55 -05:00
[Help] Allow prefix formatting in taglines (#4972)
Co-authored-by: Michael Oliveira <34169552+Flame442@users.noreply.github.com>
This commit is contained in:
parent
d322d91a18
commit
47a267b38b
@ -1683,8 +1683,11 @@ Set the tagline to be used.
|
|||||||
The maximum tagline length is 2048 characters.
|
The maximum tagline length is 2048 characters.
|
||||||
This setting only applies to embedded help. If no tagline is specified, the default will be used instead.
|
This setting only applies to embedded help. If no tagline is specified, the default will be used instead.
|
||||||
|
|
||||||
|
You can use ``[p]`` in your tagline, which will be replaced by the bot's prefix.
|
||||||
|
|
||||||
**Examples:**
|
**Examples:**
|
||||||
- ``[p]helpset tagline Thanks for using the bot!``
|
- ``[p]helpset tagline Thanks for using the bot!``
|
||||||
|
- ``[p]helpset tagline Use [p]invite to add me to your server.``
|
||||||
- ``[p]helpset tagline`` - Resets the tagline to the default.
|
- ``[p]helpset tagline`` - Resets the tagline to the default.
|
||||||
|
|
||||||
**Arguments:**
|
**Arguments:**
|
||||||
|
|||||||
@ -308,6 +308,12 @@ class RedHelpFormatter(HelpFormatterABC):
|
|||||||
command2=f"{ctx.clean_prefix}help <category>",
|
command2=f"{ctx.clean_prefix}help <category>",
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def format_tagline(ctx: Context, tagline: str):
|
||||||
|
if not tagline:
|
||||||
|
return
|
||||||
|
return tagline.replace("[p]", ctx.clean_prefix)
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def get_command_signature(ctx: Context, command: commands.Command) -> str:
|
def get_command_signature(ctx: Context, command: commands.Command) -> str:
|
||||||
parent = command.parent
|
parent = command.parent
|
||||||
@ -345,7 +351,7 @@ class RedHelpFormatter(HelpFormatterABC):
|
|||||||
|
|
||||||
description = command.description or ""
|
description = command.description or ""
|
||||||
|
|
||||||
tagline = (help_settings.tagline) or self.get_default_tagline(ctx)
|
tagline = self.format_tagline(ctx, help_settings.tagline) or self.get_default_tagline(ctx)
|
||||||
signature = _("Syntax: {command_signature}").format(
|
signature = _("Syntax: {command_signature}").format(
|
||||||
command_signature=self.get_command_signature(ctx, command)
|
command_signature=self.get_command_signature(ctx, command)
|
||||||
)
|
)
|
||||||
@ -569,7 +575,7 @@ class RedHelpFormatter(HelpFormatterABC):
|
|||||||
return
|
return
|
||||||
|
|
||||||
description = obj.format_help_for_context(ctx)
|
description = obj.format_help_for_context(ctx)
|
||||||
tagline = (help_settings.tagline) or self.get_default_tagline(ctx)
|
tagline = self.format_tagline(ctx, help_settings.tagline) or self.get_default_tagline(ctx)
|
||||||
|
|
||||||
if await self.embed_requested(ctx):
|
if await self.embed_requested(ctx):
|
||||||
emb = {"embed": {"title": "", "description": ""}, "footer": {"text": ""}, "fields": []}
|
emb = {"embed": {"title": "", "description": ""}, "footer": {"text": ""}, "fields": []}
|
||||||
@ -642,7 +648,7 @@ class RedHelpFormatter(HelpFormatterABC):
|
|||||||
return
|
return
|
||||||
|
|
||||||
description = ctx.bot.description or ""
|
description = ctx.bot.description or ""
|
||||||
tagline = (help_settings.tagline) or self.get_default_tagline(ctx)
|
tagline = self.format_tagline(ctx, help_settings.tagline) or self.get_default_tagline(ctx)
|
||||||
|
|
||||||
if await self.embed_requested(ctx):
|
if await self.embed_requested(ctx):
|
||||||
emb = {"embed": {"title": "", "description": ""}, "footer": {"text": ""}, "fields": []}
|
emb = {"embed": {"title": "", "description": ""}, "footer": {"text": ""}, "fields": []}
|
||||||
@ -763,7 +769,9 @@ class RedHelpFormatter(HelpFormatterABC):
|
|||||||
name=_("{ctx.me.display_name} Help Menu").format(ctx=ctx),
|
name=_("{ctx.me.display_name} Help Menu").format(ctx=ctx),
|
||||||
icon_url=ctx.me.display_avatar,
|
icon_url=ctx.me.display_avatar,
|
||||||
)
|
)
|
||||||
tagline = help_settings.tagline or self.get_default_tagline(ctx)
|
tagline = self.format_tagline(
|
||||||
|
ctx, help_settings.tagline
|
||||||
|
) or self.get_default_tagline(ctx)
|
||||||
ret.set_footer(text=tagline)
|
ret.set_footer(text=tagline)
|
||||||
await ctx.send(embed=ret)
|
await ctx.send(embed=ret)
|
||||||
else:
|
else:
|
||||||
@ -776,7 +784,9 @@ class RedHelpFormatter(HelpFormatterABC):
|
|||||||
name=_("{ctx.me.display_name} Help Menu").format(ctx=ctx),
|
name=_("{ctx.me.display_name} Help Menu").format(ctx=ctx),
|
||||||
icon_url=ctx.me.display_avatar,
|
icon_url=ctx.me.display_avatar,
|
||||||
)
|
)
|
||||||
tagline = help_settings.tagline or self.get_default_tagline(ctx)
|
tagline = self.format_tagline(
|
||||||
|
ctx, help_settings.tagline
|
||||||
|
) or self.get_default_tagline(ctx)
|
||||||
ret.set_footer(text=tagline)
|
ret.set_footer(text=tagline)
|
||||||
await ctx.send(embed=ret)
|
await ctx.send(embed=ret)
|
||||||
else:
|
else:
|
||||||
@ -795,7 +805,9 @@ class RedHelpFormatter(HelpFormatterABC):
|
|||||||
name=_("{ctx.me.display_name} Help Menu").format(ctx=ctx),
|
name=_("{ctx.me.display_name} Help Menu").format(ctx=ctx),
|
||||||
icon_url=ctx.me.display_avatar,
|
icon_url=ctx.me.display_avatar,
|
||||||
)
|
)
|
||||||
tagline = help_settings.tagline or self.get_default_tagline(ctx)
|
tagline = self.format_tagline(ctx, help_settings.tagline) or self.get_default_tagline(
|
||||||
|
ctx
|
||||||
|
)
|
||||||
ret.set_footer(text=tagline)
|
ret.set_footer(text=tagline)
|
||||||
await ctx.send(embed=ret)
|
await ctx.send(embed=ret)
|
||||||
else:
|
else:
|
||||||
|
|||||||
@ -4535,8 +4535,11 @@ class Core(commands.commands._RuleDropper, commands.Cog, CoreLogic):
|
|||||||
The maximum tagline length is 2048 characters.
|
The maximum tagline length is 2048 characters.
|
||||||
This setting only applies to embedded help. If no tagline is specified, the default will be used instead.
|
This setting only applies to embedded help. If no tagline is specified, the default will be used instead.
|
||||||
|
|
||||||
|
You can use `[\u200bp]` in your tagline, which will be replaced by the bot's prefix.
|
||||||
|
|
||||||
**Examples:**
|
**Examples:**
|
||||||
- `[p]helpset tagline Thanks for using the bot!`
|
- `[p]helpset tagline Thanks for using the bot!`
|
||||||
|
- `[p]helpset tagline Use [\u200bp]invite to add me to your server.`
|
||||||
- `[p]helpset tagline` - Resets the tagline to the default.
|
- `[p]helpset tagline` - Resets the tagline to the default.
|
||||||
|
|
||||||
**Arguments:**
|
**Arguments:**
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user