Akuba icon

Untitled

Akuba | PRO | 02/08/17 10:23:28 AM UTC | 0 ⭐ | 326 👁️ | Never ⏰ | []
Python |

2.89 KB

|

None

|

0 👍

/

0 👎

    async def cmd_help(self, server, author, command=None):
        """
        Usage:
            {command_prefix}help [command]
 
        Prints a help message.
        If a command is specified, it prints a help message for that command.
        Otherwise, it lists the available commands.
        
        """
        sprefix = await self.get_server_prefix(server)
 
        if command:
            cmd = getattr(self, 'cmd_' + command, None)
            if cmd:
                return Response(
                    "```\n{}```".format(
                        dedent(cmd.__doc__)
                    ).format(command_prefix=sprefix),
                    delete_after=60
                )
            else:
                return Response("No such command", delete_after=10)
 
        else:
            helpmsg = "here is a list of Commands: `"
            commands = []
            memes = []
            music = []
            serverowner = []
            botowner = []
 
 
            for att in dir(self):
                if att.startswith('cmd_') and att != 'cmd_help':
                    command_name = att.replace('cmd_', '').lower()
                    if command_name in HiddenCmds:
                        continue
                    elif command_name in MemeCmds:
                        memes.append("{}{}".format(sprefix, command_name))
                    elif command_name in BotOwnerCmds:
                        botowner.append("{}{}".format(sprefix, command_name))
                    elif command_name in VoiceCmds:
                        music.append("{}{}".format(sprefix, command_name))
                    elif command_name in ServerOwnerCmds:
                        serverowner.append("{}{}".format(sprefix, command_name))
                    else:   
                        commands.append("{}{}".format(sprefix, command_name))
 
            helpmsg += ", ".join(commands)
            helpmsg += "`"
 
            helpmsg += "\n**Meme Generator:** `"
            helpmsg += ", ".join(memes)
            helpmsg += "`"
 
            helpmsg += "\n**Music Commands:** `"
            helpmsg += ", ".join(music)
            helpmsg += "`"
 
            if author.id == self.config.owner_id:
                helpmsg += "\n**Serverowner-Commands:** `"
                helpmsg += ", ".join(serverowner)
                helpmsg += "`"
                helpmsg += "\n**Botowner-Commands:** `"
                helpmsg += ", ".join(botowner)
                helpmsg += "`"
            else:
                if author.id == server.owner.id:
                    helpmsg += "\n**Serverowner-Commands:** `"
                    helpmsg += ", ".join(serverowner)
                    helpmsg += "`"
 
            helpmsg += "\n You can also use `{}help [command]` for more info about each command.".format(sprefix)
            return Response(helpmsg, reply=True, delete_after=60)

Comments

  •  icon
    01/01/70 12:00:00 AM UTC
    Plain Text |

    0 B

    |

    👍

    /

    👎