From 8619c9223ee8772211a102d473c0020264836765 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kuba=20Trzci=C5=84ski?= Date: Tue, 29 Nov 2022 18:05:45 +0100 Subject: [PATCH 1/2] Help for `graf`` command --- .../Science/Maths/Functions/graphs.py | 45 +++++++------------ 1 file changed, 15 insertions(+), 30 deletions(-) diff --git a/PyChan/Core/Commands/Science/Maths/Functions/graphs.py b/PyChan/Core/Commands/Science/Maths/Functions/graphs.py index fdc0346..681d794 100644 --- a/PyChan/Core/Commands/Science/Maths/Functions/graphs.py +++ b/PyChan/Core/Commands/Science/Maths/Functions/graphs.py @@ -15,16 +15,10 @@ def __init__(self, bot): pass_context=True, name="prufer", category="Nauka", - help_={ - "title": "Prufer", - "description": "Funkcja do rysowania drzewa z kodu Prüfera.", - "fields": [ - { - "name": "Składnia", - "value": "`prufer `", - }, - ], - }, + help = """ + Funkcja do rysowania drzewa z kodu Prüfera + """, + usage = "" ) async def prufer(self, ctx, *, code): """ @@ -83,25 +77,7 @@ async def prufer(self, ctx, *, code): pass_context=True, name="graf", aliases=["g"], - category="Nauka", - help_={ - "title": "Graf", - "description": "Funkcja do rysowania grafów nieskierowanych.", - "fields": [ - { - "name": "Składnia", - "value": "`graf rysuj [lista wierzchołków] [lista krawędzi]` - wyświetla informacje o permutacji.", - }, - { - "name": "Aliasy komendy", - "value": "`graf`, `g`", - }, - { - "name": "Dodatkowe informacje", - "value": "W liście wierzchołków nie trzeba uwzględniać tych, które są wymienione w liście krawędzi.\nPrzykład użycia: `g rysuj [] [(1,2)(1,3)(2,3)]` - generuje graf pełny K3", - }, - ], - }, + category="Nauka", ) async def graf(self, ctx): """ @@ -117,7 +93,16 @@ async def graf(self, ctx): ) ) - @graf.command(name="rysuj") + @graf.command( + name="rysuj", + help = """ + Funkcja do rysowania grafów nieskierowanych + + **Dodatkowe informacje** + W liście wierzchołków nie trzeba uwzględniać tych, które są wymienione w liście krawędzi.\nPrzykład użycia: `g rysuj [] [(1,2)(1,3)(2,3)]` - generuje graf pełny K3 + """, + usage = " " + ) async def rysuj(self, ctx, *, args): """ Sends the reply message to the user with graph image From 1f541038f7da76e599c0b574860aa556f54fa81d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kuba=20Trzci=C5=84ski?= Date: Tue, 29 Nov 2022 18:07:28 +0100 Subject: [PATCH 2/2] Display commandgroup aliases in help --- PyChan/Core/help.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/PyChan/Core/help.py b/PyChan/Core/help.py index ead4034..3e4985e 100644 --- a/PyChan/Core/help.py +++ b/PyChan/Core/help.py @@ -54,6 +54,9 @@ async def send_group_help(self, group: Group): embed.description = f'Wpisz `{prefix}help {group.name} ` aby dowiedzieć się więcej o danej podkomendzie' embed.add_field(name="Dostępne podkomendy", value=', '.join(list(map(lambda c: f'`{c.name}`', group.all_commands.values())))) + if len(group.aliases) > 0: + embed.add_field(name="Aliasy komendy", value=', '.join(list(map(lambda a: f'`{a}`', group.aliases)))) + return await self.get_destination().send(embed=embed) async def subcommand_not_found(self, command: Command, string: str):