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

rules: allow toggling case sensitivity #2484

Open
dgw opened this issue Jul 8, 2023 · 1 comment
Open

rules: allow toggling case sensitivity #2484

dgw opened this issue Jul 8, 2023 · 1 comment

Comments

@dgw
Copy link
Member

dgw commented Jul 8, 2023

Requested Feature

Plugin rules defined using @rule, @search, @find, and friends are currently forced to be case insensitive. Bot-owner users ask often enough about making certain custom triggers case-sensitive that we should allow for it in the API.

We've dropped enough old Python versions that we should be able to add keyword-only arguments to the relevant decorators.

Problems Solved

Use cases for this functionality mostly revolve around reducing accidental triggering of rules that overlap with common words/abbreviations. I can see a few places in first-party code where it could be useful, too, like in sopel-reddit's slash-reference matching.

Alternatives

Alternatives are pretty hacky: defining the case-insensitive rule or matching on all messages, and then matching a second time at the beginning of the plugin callable with a case-sensitive pattern.

Matching the same line twice is inefficient, on top of making the plugin code messy.

Notes

No response

@Exirel
Copy link
Contributor

Exirel commented Oct 21, 2024

This would fit nicely with the feature request #462. After all, they both want to give more control over how the @rule decorator and friends match against the IRC message.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants