-
-
Notifications
You must be signed in to change notification settings - Fork 402
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
coretasks: activate message-tags
and use it to ignore other bots' tagged messages
#2089
Conversation
To @Exirel's point on IRC, I'm about to (force-)push a revision that prevents this from overriding the existing >>> for b in [True, False]:
... for e in [True, False]:
... for a in [True, False]:
... res = ((not b or (e and a)) and (not e or a))
... print('bot: {}, echo: {}, allowecho: {}, result: {}'.format(b, e, a, res))
...
bot: True, echo: True, allowecho: True, result: True
bot: True, echo: True, allowecho: False, result: False
bot: True, echo: False, allowecho: True, result: False
bot: True, echo: False, allowecho: False, result: False
bot: False, echo: True, allowecho: True, result: True
bot: False, echo: True, allowecho: False, result: False
bot: False, echo: False, allowecho: True, result: True
bot: False, echo: False, allowecho: False, result: True Elegant? No. Still useful. Future previewWent ahead and worked on some of the "later pull request" to add the tentatively named for is_bot_message in [True, False]:
for allow_bots in [True, False]:
for is_echo_message in [True, False]:
for allow_echo in [True, False]:
res = (
(not is_bot_message or allow_bots) or
(is_echo_message and allow_echo)
) and (not is_echo_message or allow_echo)
print('bot: {:d}, allowbots: {:d}, echo: {:d}, allowecho: {:d}, result: {}'.format(
is_bot_message, allow_bots, is_echo_message, allow_echo, res))
Preview of code changes in 61544fc, current (draft) HEAD of |
Well I was going to properly rebase this after clicking through GitHub's conflict-resolution flow, but Coveralls is down and causing our builds to error. Just another Saturday, I guess. 😅 Note to self: rebased branch is on Lamarr ready to force-push whenever Coveralls comes back. |
Only PRIVMSG and NOTICE messages from bots are filtered out, so this change doesn't affect Sopel's user tracking. JOINs, PARTs, etc. can be included later, once there exists a decorator that event handlers can use to turn this `bot` filter off. Currently supports the `draft/bot` tag AND the `bot` tag that will be used when the relevant IRCv3 extension leaves draft status. It seems like the future-proofing is of minimal risk here.
e3593eb
to
7547fb4
Compare
Description
Filter out
PRIVMSG
andNOTICE
commands that have thebot
(ordraft/bot
) tag. Other events should be left alone until there's a decorator to opt back into them, or Sopel itself will no longer even be aware of bot users' existence on networks that implement one of these tags (which per the spec "SHOULD" be added to all commands sent, and numerics caused, by a bot client).A later pull request can introduce the needed decorator and changes to Rule constructors for certain callables to allow
bot
messages (à la@plugin.echo
). Trying to keep stuff in manageable chunks so nobody gets burned out on reviews. 😸Part of #2079.
Checklist
make qa
(runsmake quality
andmake test
)pytest
!Notes
I really want to skip over the part where we have to support only
draft/bot
and then come back later to add support for the finalbot
tag name. Technically we shouldn't do that if the spec isn't ratified by the time Sopel 8 goes stable, though.