refactor of code
This commit is contained in:
20
jeevesbot/bothelp.py
Normal file
20
jeevesbot/bothelp.py
Normal file
@@ -0,0 +1,20 @@
|
||||
keywords = ['gifbot']
|
||||
|
||||
def help(keyword=''):
|
||||
"""Filter for general help or specific keyword help."""
|
||||
if not keyword:
|
||||
file = open('help/help.md')
|
||||
contents = file.read()
|
||||
return (contents)
|
||||
if keyword[0]:
|
||||
keyword = str.lower(keyword)
|
||||
if keyword in keywords:
|
||||
document = 'help/help_' + keyword + '.md'
|
||||
print(document)
|
||||
file = open(document, 'r')
|
||||
contents = file.read()
|
||||
return (contents)
|
||||
else:
|
||||
file = open('help/help.md')
|
||||
contents = file.read()
|
||||
return (contents)
|
||||
Reference in New Issue
Block a user