Skip to content

Commit

Permalink
fix behavior of help command when USAGE has empty lines
Browse files Browse the repository at this point in the history
rewrites empty lines in body to a single space in the call to message.copy
  • Loading branch information
antithalian committed Oct 27, 2023
1 parent 7b65d2d commit d414814
Showing 1 changed file with 3 additions and 1 deletion.
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

0 comments on commit d414814

Please sign in to comment.