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

Implement changing of sed response per channel (fixes #1433) #1556

Merged
merged 7 commits into from
Sep 19, 2023
Merged

Implement changing of sed response per channel (fixes #1433) #1556

merged 7 commits into from
Sep 19, 2023

Conversation

famfo
Copy link
Contributor

@famfo famfo commented Sep 18, 2023

No description provided.

@progval
Copy link
Owner

progval commented Sep 18, 2023

Thanks! Could you also make the '%s thinks %s' part configurable?

In order for it to make sense, you can use two independent config variables, ie. $nick meant to say: $replacement and $otherNnick thinks $nick meant to say: $replacement and ircutils.standardSubstitute(irc, m, self.registryValue(...), {'otherNick': msg.nick, 'replacement': subst}) which gives more flexibility to bot admins (they can use $host, date, etc.)

@famfo
Copy link
Contributor Author

famfo commented Sep 18, 2023

Sure, I can look into it.

@jlu5 jlu5 changed the base branch from master to testing September 18, 2023 19:15
Copy link
Collaborator

@jlu5 jlu5 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add tests for the additional config options to SedRegex/test.py ?

plugins/SedRegex/plugin.py Outdated Show resolved Hide resolved
@famfo famfo requested a review from jlu5 September 18, 2023 20:57
plugins/SedRegex/plugin.py Outdated Show resolved Hide resolved
Co-authored-by: Val Lorentz <progval+github@progval.net>
@@ -57,6 +57,17 @@ def configure(advanced):
conf.registerChannelValue(SedRegex, 'ignoreRegex',
registry.Boolean(True, _("""Should Perl/sed regex replacing
ignore messages which look like valid regex?""")))
conf.registerChannelValue(SedRegex, 'sedString',
Copy link
Collaborator

@jlu5 jlu5 Sep 19, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would name this variable formatString and the other one formatString.other so that their meaning is clearer just from their names. (To register a variable under another one you could do something like conf.registerChannelValue(SedRegex.formatString, 'other', ...)

LGTM otherwise!

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just format instead of formatString

@famfo famfo requested a review from jlu5 September 19, 2023 11:53
plugins/SedRegex/config.py Outdated Show resolved Hide resolved
plugins/SedRegex/config.py Outdated Show resolved Hide resolved
plugins/SedRegex/test.py Outdated Show resolved Hide resolved
@jlu5 jlu5 self-requested a review September 19, 2023 15:54
@jlu5 jlu5 merged commit 91accc0 into progval:testing Sep 19, 2023
12 checks passed
@famfo famfo deleted the fix/sed_response branch September 19, 2023 16:29
@progval
Copy link
Owner

progval commented Sep 19, 2023

@famfo thanks!

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.

3 participants