Condensing the help method into just two lines!, fixes #8
This commit is contained in:
parent
04eaeb624d
commit
2fc4f4f7ab
@ -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'):
|
||||
|
@ -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')
|
||||
|
Loading…
x
Reference in New Issue
Block a user