Akuba

Untitled

Feb 8th, 2017
364
0
Never
1
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 2.89 KB | None | 0 0
  1.     async def cmd_help(self, server, author, command=None):
  2.         """
  3.        Usage:
  4.            {command_prefix}help [command]
  5.  
  6.        Prints a help message.
  7.        If a command is specified, it prints a help message for that command.
  8.        Otherwise, it lists the available commands.
  9.        
  10.        """
  11.         sprefix = await self.get_server_prefix(server)
  12.  
  13.         if command:
  14.             cmd = getattr(self, 'cmd_' + command, None)
  15.             if cmd:
  16.                 return Response(
  17.                     "```\n{}```".format(
  18.                         dedent(cmd.__doc__)
  19.                     ).format(command_prefix=sprefix),
  20.                     delete_after=60
  21.                 )
  22.             else:
  23.                 return Response("No such command", delete_after=10)
  24.  
  25.         else:
  26.             helpmsg = "here is a list of Commands: `"
  27.             commands = []
  28.             memes = []
  29.             music = []
  30.             serverowner = []
  31.             botowner = []
  32.  
  33.  
  34.             for att in dir(self):
  35.                 if att.startswith('cmd_') and att != 'cmd_help':
  36.                     command_name = att.replace('cmd_', '').lower()
  37.                     if command_name in HiddenCmds:
  38.                         continue
  39.                     elif command_name in MemeCmds:
  40.                         memes.append("{}{}".format(sprefix, command_name))
  41.                     elif command_name in BotOwnerCmds:
  42.                         botowner.append("{}{}".format(sprefix, command_name))
  43.                     elif command_name in VoiceCmds:
  44.                         music.append("{}{}".format(sprefix, command_name))
  45.                     elif command_name in ServerOwnerCmds:
  46.                         serverowner.append("{}{}".format(sprefix, command_name))
  47.                     else:  
  48.                         commands.append("{}{}".format(sprefix, command_name))
  49.  
  50.             helpmsg += ", ".join(commands)
  51.             helpmsg += "`"
  52.  
  53.             helpmsg += "\n**Meme Generator:** `"
  54.             helpmsg += ", ".join(memes)
  55.             helpmsg += "`"
  56.  
  57.             helpmsg += "\n**Music Commands:** `"
  58.             helpmsg += ", ".join(music)
  59.             helpmsg += "`"
  60.  
  61.             if author.id == self.config.owner_id:
  62.                 helpmsg += "\n**Serverowner-Commands:** `"
  63.                 helpmsg += ", ".join(serverowner)
  64.                 helpmsg += "`"
  65.                 helpmsg += "\n**Botowner-Commands:** `"
  66.                 helpmsg += ", ".join(botowner)
  67.                 helpmsg += "`"
  68.             else:
  69.                 if author.id == server.owner.id:
  70.                     helpmsg += "\n**Serverowner-Commands:** `"
  71.                     helpmsg += ", ".join(serverowner)
  72.                     helpmsg += "`"
  73.  
  74.             helpmsg += "\n You can also use `{}help [command]` for more info about each command.".format(sprefix)
  75.             return Response(helpmsg, reply=True, delete_after=60)
Advertisement
Comments
  • User was banned
Add Comment
Please, Sign In to add comment