Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix behavior of help command when USAGE has empty lines #78

Open
wants to merge 1 commit into
base: bobbit-0.2.x
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/bobbit/modules/help.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@ async def help(bot, message, module_name=None):
# Lookup specific help message
if module_name in all_modules:
responses = all_modules[module_name].USAGE.splitlines()
return [message.copy(body=r) for r in responses]
# message.copy(body='') returns the original body of the message
# when an empty line is encountered, send message.copy a single space so that usage is printed as expected
return [message.copy(body=r) if r != '' else message.copy(body=' ') for r in responses]

# If module_name not found, alert user and return command list
responses = [f'\"{module_name}\" not found. Try these: ',', '.join(sorted(all_modules))]
Expand Down