-
-
Notifications
You must be signed in to change notification settings - Fork 403
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
core: perform commands on connect #1528
core: perform commands on connect #1528
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like there's some amount of "wonk factor" between Travis and draft PRs still, leading to this PR not getting built when you marked it ready for review. As it happens, that won't be an issue this time because I have things I'd like changed. (And you'll probably rebase this anyway after #1460 goes in—up to you if you address feedback now or wait until I merge that… Soon™.)
7411faf
to
bb1c8bd
Compare
@HumorBaby this need to be rebased since the PR it requires has been merged. About the feature itself... I'm not super happy about it. I feel like we are trying to provide a half-baked hook into Sopel to help admin users implement a feature Sopel does not handle yet. So... meh? Maybe this comment should be in #1455 though... |
My perspective on this is, we aren't going to add support for every little feature on every obscure IRCd or network. Sending arbitrary commands at connect is frequently requested, and is (anecdotally) supported by most other popular IRC clients. |
bb1c8bd
to
b000dc6
Compare
So I made quite a few changes on top of the last requested changed:
Hopefully (4) was the only un-solicited/-desired/-expected change after what seemed like a completely trivial requested change in the review 😅. Since I was rebasing on master anyway, I squashed/reordered previous commits as necessary. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't have much to say on this one. The tests look solid, which means the logic looks solid, and all that's left is to decide which gets merged first: this or #1628. I'd like to pull in the config changes first, but I fear that that invites further delay of this because @HumorBaby often doesn't have time to update PRs for days or weeks at a time.
HB, do you mind leaving this for one more go-around after the newline stuff goes in?
Addressed. Final approval pending another PR's state.
This is one of only three "review required" PRs not authored by me. One is deferred until Sopel 8, one is just so big I haven't had time to look at it, and this one has a merge conflict now after waiting so long for #1628 to tweak how @HumorBaby do you need to make any updates to this, besides the merge conflict? Or is it drop-in compatible with the |
Should be a drop in. Will confirm, of course. |
Docs too, I hope. Any examples should use the new style, for example. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Needs updates to documentation, as described (and predicted) by the TODO comments left in.
So, I've no idea how I can push my commits to @HumorBaby 's branch. So I've my own branch, available here: master...Exirel:feat-perform-commands-on-connect It contains an up-to-date version of this branch, rebased upon the latest sopel/master branch, with the tests modified to fit with the new tests tools. |
@Exirel short answer: EDIT: So I don't forget later, this should be able to drop the |
b000dc6
to
ca31286
Compare
And also fix the PR so it can be merged. I'll work on that later (probably tomorrow morning). |
Adds a setting in `core` called `commands_on_connect` based on the updated `ListAttribute` from sopel-irc#1460. This setting stores a comma separated list of raw IRC commands (`\`-escaped commas in commands) to execute upon successful connection to the server. As @dgw put it, "Think ZNC's perform module, but without the ability to add/remove/rearrange lines from an IRC query" in sopel-irc#1455. The commands in the `commands_on_connect` list are executed at the end of the `startup` procedure. They can also be called by a bot admin with the `.execute` command. Note: two `TODO`s were added to adjust docstrings and docs once sopel-irc#1628 is accepted, since it will change the `ListAttribute` delimiter from commas to newlines. Closes sopel-irc#1455
ca31286
to
658bd07
Compare
@dgw rebased upon master, docstrings fixed, and |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you @HumorBaby for taking this so far!
And thank you @Exirel for finishing the last bits (and tweaking it for your own test-suite changes 😛)!
.. seealso:: | ||
|
||
This functionality is analogous to ZNC's ``perform`` module: | ||
https://wiki.znc.in/Perform | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
At some point we'll standardize the indent for blocks like this (I tend to use 4 because I just press Tab in my editor), but I'm not going to quibble over it until we actually have a documentation style guide. Writing one is on my to-do list for 7.1-ish.
This PR is meant to address #1455. It adds a
core
setting that is aListAttribute
of commands to perform upon successful connection with the IRC server. These commands are executed at the end of thestartup
sequence (setMODE
s,JOIN
channels, and now, perform commands).It depends on #1460.
Example setting
raw.log
, as expected:Note:
Why
[core]
?I had considered two alternatives to adding
perform_commands
directly into core:perform
its own modulelist
,swap
,add
,del
commands from ZNC's perform as commands that the bot's admin can use@interval
on a function that checks ifbot.connection_registered
; once connected, execute the commands; remove the@interval
function from the job scheduler (from within the same function itself).reload
without additional measures to track the execution status of commandsstartup
function to perform actions).reload
💥... it's bad enough register/unregistering commandsPlans
I hope a solution like (2) can be achieved at some point. With all the changes to the module loading interface coming along, I think it would be reasonable (and relatively simple) to migrate this to its own module.