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

Blank lines in USAGE produce unwanted behavior with !help #71

Open
evstar3 opened this issue Feb 10, 2023 · 0 comments
Open

Blank lines in USAGE produce unwanted behavior with !help #71

evstar3 opened this issue Feb 10, 2023 · 0 comments

Comments

@evstar3
Copy link
Contributor

evstar3 commented Feb 10, 2023

Overview

Calling !help on a module with a blank line in its USAGE produces unwanted behavior.

Okay, why?

When !help is called, Bobbit produces a message with message.copy() for each line in USAGE. When there is a blank line in USAGE, one of these calls will be message.copy(body=''). In the copy method, the body evaluates to false and the original body of the !help command is copied. Because message.copy() also copies the nick, Bobbit sees this message as a command invocation and replies to it.

Affected Modules

Note: this list was made with the following dope one-liner
find src/bobbit/modules -maxdepth 1 -type f | xargs -I {} sh -c "sed -ne \"/USAGE[^=]*=/,/'''/p\" {} | grep -qE '^$' && echo \$(basename {})"

archive.py
bodule.py
brainfuck.py
clap.py
copypasta.py
googletranslate.py
grab.py
humanity.py
karma.py
metar.py
mock.py
rpcs.py
weather.py
wttr.py

@evstar3 evstar3 changed the title Blank lines in module USAGE produce unwanted behavior with !help Blank lines in USAGE produce unwanted behavior with !help Feb 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant