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

Drop text of bot prefix only if it is a prefix #47

Merged
merged 1 commit into from
Oct 10, 2024
Merged

Conversation

dalarsen
Copy link
Contributor

Currently if a command string contains the text of the plugin name, but it is not the prefix, it will still get stripped from the command string, for example:

If the command is "hello wombats are great"

and the bot prefix is "wombat"

it would strip the command to "hello s are great"

With this change it will only strip the bot/plugin prefix from the command string if it appears as the first part of the string.

@dalarsen
Copy link
Contributor Author

dalarsen commented Sep 21, 2023

Hmm, I just noticed that .removeprefix requires py3.9, maybe I should do this some other way.

On the other hand, errbotio errbot docker image uses 3.9 though, so it may be fine?

@nzlosh
Copy link
Owner

nzlosh commented Sep 21, 2023

Are you to elaborate on the configuration your using for errbot + err-stackstorm as well as the stackstorm action-alias definition that is being stripped?

err-stackstorm isn't constrained to running in a docker image and used in production on server running python3.8.

@dalarsen
Copy link
Contributor Author

We have modifications that allow for chatops commands to be made without the bot prefix, which is why the text that matches the bot prefix may or may not be the bot prefix itself and could be part of the rest of the command, such that:

bot prefix: mrbot

with prefix:

command "mrbot please do something for mrbot" -> removes first instance of "mrbot" and leaves "please do something for mrbot"

with our modifications to not require the prefix:

command: "please do something for mrbot" -> removes first instance of "mrbot" and leaves "please do something for"

But, unless you are using non-prefixed commands, this isn't something that would come up. And without a guarantee of py3.9, this change would be more complicated and more ugly. So, maybe picking up this change would not be worthwhile.

@nzlosh
Copy link
Owner

nzlosh commented Sep 21, 2023

I'm reluctant to integrate code changes to accommodate a modified version of the plugin. That said, the fix looks reasonable for the actual use cases supported by the plugin. If you want to leave this open, I'll merge it after py3.8 goes EOL.

@dalarsen
Copy link
Contributor Author

Will do. Thanks!

@nzlosh nzlosh merged commit 42d9bf7 into nzlosh:main Oct 10, 2024
@nzlosh
Copy link
Owner

nzlosh commented Oct 10, 2024

The day has finally come, py3.8 support is dropped. Thanks for the PR.

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

Successfully merging this pull request may close these issues.

2 participants