def get_help_message(method): """ get_help_message(method) Returns the information and usage of each of dragon bot's funtions. When adding a new feature to dragon bot, please add some information about it here """ supported_methods = { '8ball': [ 'Ask dragon bot a question and it will give you an 8ball response', '\nUsage: !8ball Will I win the lottery tomorrow?' ], 'avatar': [ 'Returns the avatar for the mentioned user', '\nUsage: !avatar @somebody' ], 'decide': [ 'Dragon-bot will help make the tough decisions for you', ' If there is only one option, it will give you a yes or no', '\nUsage: !decide cake or pie\n!decide should I do my homework' ], 'define': [ 'Returns a definiton of a word from urban dictionary', '\nUsage: !define loli' ], 'docker': [ 'Two supported actions: logs and restart\nlogs: Shows you the', 'last X number of lines from the minecraft server. If no number', ' is specified, defaults to 10.\nrestart: will restart the min', 'ecraft server.' ], 'dog': [ 'Returns the URL to a G O O D B O Y E or G I R L', '\nUsage: !dog' ], 'emoji': [ 'Uploads the passed in URL to the server as an emoji.', '\nDiscord does not support GIFS. It will throw and error if you try.' '\nCurrently only admins can do this', '\nUsage: !emoji http://pictures.com/some_image.png my_new_emoji' ], 'excuse': [ 'Generates a random excuse you can give your boss', '\nUsage: !excuse' ], 'greentext': [ 'Grabs a greentext story from redditchat so you can laugh at the misfortune of others', '\nUsage: !greentext' ], 'help': [ 'Shows you this message' ], 'lewd': [ 'Returns a URL for a lewd image.', 'Can only be used in NSFW channels.', '\nUsage: !lewd' ], 'purge': [ 'By default, will delete your last 20 messages. You can override this', ' with your own number. \nUsage: !purge or !purge 15' ], 'roles': [ 'Dragon bot will PM you a message with all the roles you have on the server' ], 'wallpaper': [ 'Returns the URL for a 4k wallpaper. You can enter', 'a search term as well. Supports multiple search terms as well', '\nUsage: !wallpaper flowers or !wallpaper mountain flowers sky ' ], 'message': [ 'You can ask me a question directly and I will do my best to answer it.', '\nUsage: @dragon-bot what is the capital of France?' ], 'homepage': [ 'This function now outputs the SWEET-ASS picture of the day.', ' Note this picture only changes once a day.', '\nUsage: !homepage' ], 'weather': [ 'Returns the weather for the location you entered.', '\nUsage: !weather Berkeley' ], 'pout': [ 'Returns the URL for an anime girl pouting you filthy weeb' ], 'smug': [ 'Returns the URL for smug anime girl' ], 'source': [ "Links you to the git repo with dragon-bot's source code" ], 'stock': [ 'Returns basic stock information for the stock you entered.', '\nUsage: !stock AAPL TSLA' ], 'tts': [ 'Uploads a file with the specified text as an MP3. This is advanced shitposting', '\nUsage: !tts who watches the watchmen?' ], } # Print out every help method if method == 'show_all': # Might be a better way to do this, but build a list of method : description build_message = [] for key, value in supported_methods.items(): build_message.append("\n{} : {}\n".format(key, ' '.join(supported_methods[key]))) # Join every element of the list with a space message = ' '.join(build_message) else: # Join key : value of the help method they passed in message = "{} : {}".format(method, ' '.join(supported_methods[method])) return "\n{}\n".format(message) def parse_message(message): method = 'show_all' if len(message.split()) > 1: method = message.split()[1] try: explanation = get_help_message(method) except KeyError: return "I can't help you with that" return "```css\n{}\n```".format(explanation)