From 371fbe3db92d50725c11aa1d716313573876a4a0 Mon Sep 17 00:00:00 2001 From: pocketjawa Date: Fri, 2 Mar 2018 21:48:40 -0500 Subject: [PATCH] Modified help command to give read per command help files. --- pocketbot.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/pocketbot.py b/pocketbot.py index 74f7155..b216e97 100644 --- a/pocketbot.py +++ b/pocketbot.py @@ -77,8 +77,16 @@ def on_message(message): #Posts help info elif message.content.lower().startswith('!help'): - helpfile = open(cwd + "/helpcommand.txt","r") - yield from client.send_message(message.channel, helpfile.read()) + args = message.content.partition(' ')[2] + command = args.partition(' ')[0] + if (command is '' ): + helpfile = open(cwd + "/helpcommand.txt","r") + yield from client.send_message(message.channel, helpfile.read()) + elif os.path.isfile(cwd + "/helptext/" + command): + commandhelp = open(cwd + "/helptext/" + command,"r") + yield from client.send_message(message.channel, commandhelp.read()) + else: + yield from client.send_message(message.channel, 'Either that command does not exist, or it is too simple to deserve extra context <:tohrusmug:292110413129318401>') #Sleeps for 5 seconds. Don't know why I still have this tbh elif message.content.lower().startswith('!sleep'):