90 lines
3.4 KiB
Python
90 lines
3.4 KiB
Python
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?'
|
|
],
|
|
'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.'
|
|
],
|
|
'excuse': [
|
|
'Generates a random excuse you can give your boss',
|
|
'\nUsage: !excuse'
|
|
],
|
|
'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'
|
|
]
|
|
}
|
|
|
|
# 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 the message wrapped in css formatting so we get pretty colors
|
|
return "```css\n{}\n```".format(message)
|
|
|
|
def parse_message(message):
|
|
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)
|
|
|
|
return get_help_message('show_all')
|