From ba25078f3fa63f4bed17e286f5662b7fbc3aaa2b Mon Sep 17 00:00:00 2001 From: SeaswimmerTheFsh Date: Fri, 29 Mar 2024 07:18:55 -0400 Subject: [PATCH] feat(pterodactyl): added custom formatting for the cog-level help embed --- pterodactyl/pterodactyl.py | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/pterodactyl/pterodactyl.py b/pterodactyl/pterodactyl.py index 601106a..ae5ea2b 100644 --- a/pterodactyl/pterodactyl.py +++ b/pterodactyl/pterodactyl.py @@ -9,7 +9,7 @@ from pydactyl import PterodactylClient from redbot.core import app_commands, commands from redbot.core.app_commands import Choice from redbot.core.bot import Red -from redbot.core.utils.chat_formatting import box, error +from redbot.core.utils.chat_formatting import box, error, humanize_list from redbot.core.utils.views import ConfirmView from pterodactyl import mcsrvstatus @@ -20,6 +20,10 @@ from pterodactyl.logger import logger class Pterodactyl(commands.Cog): """Pterodactyl allows you to manage your Pterodactyl Panel from Discord.""" + __author__ = ["SeaswimmerTheFsh"] + __version__ = "2.0.0" + __documentation__ = "https://seacogs.coastalcommits.com/pterodactyl/" + def __init__(self, bot: Red): self.bot = bot self.client: Optional[PterodactylClient] = None @@ -30,6 +34,17 @@ class Pterodactyl(commands.Cog): self.task = self.get_task() self.update_topic.start() + def format_help_for_context(self, ctx: commands.Context) -> str: + pre_processed = super().format_help_for_context(ctx) or "" + n = "\n" if "\n\n" not in pre_processed else "" + text = [ + f"{pre_processed}{n}", + f"Cog Version: **{self.__version__}**", + f"Author: {humanize_list(self.__author__)}", + f"Documentation: {self.__documentation__}", + ] + return "\n".join(text) + async def cog_unload(self) -> None: self.update_topic.cancel() self.task.cancel()