Condensing the help method into just two lines!, fixes #8

This commit is contained in:
Luke Robles 2017-08-09 13:56:11 -07:00
parent 04eaeb624d
commit 2fc4f4f7ab
2 changed files with 13 additions and 19 deletions

View File

@ -131,25 +131,8 @@ async def on_message(message):
await client.send_message(message.channel, "`{}`\n```{}```".format(' '.join(word), definition))
if message.content.startswith('!help'):
if len(message.content.split()) > 1:
method = message.content.split()[1]
try:
explanation = help_methods.get_help_message(method)
except KeyError:
await client.send_message(
message.channel,
"I can't help you with that"
)
return
await client.send_message(
message.channel,
"```{}```".format(explanation)
)
else:
await client.send_message(
message.channel,
help_methods.get_help_message('show_all')
)
help_message = help_methods.parse_message(message.content)
await client.send_message(message.channel, help_message)
if 'autis' in message.content or message.content.startswith('!triggered'):

View File

@ -45,3 +45,14 @@ def get_help_message(method):
else:
message = ' '.join(supported_methods[method])
return 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 "```{}```".format(explanation)
else:
return get_help_message('show_all')