Merged in help_module (pull request #16)
Condensing the help method into just two lines!, fixes #8
This commit is contained in:
commit
c01aa83df8
@ -131,25 +131,8 @@ async def on_message(message):
|
|||||||
await client.send_message(message.channel, "`{}`\n```{}```".format(' '.join(word), definition))
|
await client.send_message(message.channel, "`{}`\n```{}```".format(' '.join(word), definition))
|
||||||
|
|
||||||
if message.content.startswith('!help'):
|
if message.content.startswith('!help'):
|
||||||
if len(message.content.split()) > 1:
|
help_message = help_methods.parse_message(message.content)
|
||||||
method = message.content.split()[1]
|
await client.send_message(message.channel, help_message)
|
||||||
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')
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
if 'autis' in message.content or message.content.startswith('!triggered'):
|
if 'autis' in message.content or message.content.startswith('!triggered'):
|
||||||
|
@ -45,3 +45,14 @@ def get_help_message(method):
|
|||||||
else:
|
else:
|
||||||
message = ' '.join(supported_methods[method])
|
message = ' '.join(supported_methods[method])
|
||||||
return message
|
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)
|
||||||
|
|
||||||
|
return get_help_message('show_all')
|
||||||
|
Loading…
x
Reference in New Issue
Block a user