InterStella0 / starlight-dpy

A utility library that she uses for discord.py
https://starlight-dpy.readthedocs.io/en/latest/
MIT License
18 stars 4 forks source link

questions about the help command #12

Closed pingu6 closed 1 year ago

pingu6 commented 1 year ago

how to hide help command from help command? also is there way to remove start_button and end_button? idk but for small bots it won't be needed

InterStella0 commented 1 year ago

Yes, hiding help command is discord.py built-in. Removing start_button/end_button, assuming this is MenuHelpCommand, you can provide your own mapping to pagination_buttons kwargs in your constructor,

class MyMenuHelpCommand(startlight.MenuHelpCommand):
    def __init__(self, *args, **kwargs):
        row = 1 # your button placement
        super().__init__(*args, 
            command_attrs={'hidden': True},
            pagination_buttons={
                'previous_button': discord.ui.Button(emoji="◀️", row=row),
                'stop_button': discord.ui.Button(emoji="⏹️", row=row),
                'next_button': discord.ui.Button(emoji="▶️", row=row),
            }, **kwargs)
pingu6 commented 1 year ago

Yes, hiding help command is discord.py built-in. Removing start_button/end_button, assuming this is MenuHelpCommand, you can provide your own mapping to pagination_buttons kwargs in your constructor,

class MyMenuHelpCommand(startlight.MenuHelpCommand):
    def __init__(self, *args, **kwargs):
        row = 1 # your button placement
        super().__init__(*args, 
            command_attrs={'hidden': True},
            pagination_buttons={
                'previous_button': discord.ui.Button(emoji="◀️", row=row),
                'stop_button': discord.ui.Button(emoji="⏹️", row=row),
                'next_button': discord.ui.Button(emoji="▶️", row=row),
            }, **kwargs)

doesn't work: image image

InterStella0 commented 1 year ago

My mistake, you should set the missing key to None for it to remove it, otherwise it will be replaced with an existing button.

class MyMenuHelpCommand(starlight.MenuHelpCommand):
    def __init__(self, *args, **kwargs):
        row = 1 # your button placement
        super().__init__(*args, 
            command_attrs={'hidden': True},
            pagination_buttons={
                'start_button': None,
                'end_button': None,
                'previous_button': discord.ui.Button(emoji="◀️", row=row),
                'stop_button': discord.ui.Button(emoji="⏹️", row=row),
                'next_button': discord.ui.Button(emoji="▶️", row=row),
            }, **kwargs)