-
-
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
module: add action_commands decorator #1660
Conversation
Test file used:
Output:
|
Looking at this led me to the discovery that inspired #1683. Specifically, the implementation here made me wonder "what other intents are there?", which led to finding out that the intent spec no longer exists. This decorator is a pretty good idea, actually, especially because we'll want to replace the internal references to "intents" on callables and triggers with something else that isn't obsolete. Could be as simple as |
fb71d6a
to
97255de
Compare
Forced Pushed to rebase with current master. I could use some help writing the tests for A thorough review would also be nice to clean/tidy it up. However, I feel fairly positive about what is accomplished here. As discussed via IRC, this can be implemented, with the current
|
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.
Right, so it looks like this should do what is expected/desired. We do have to think about future-proofing and decorator interactions, though.
For example, if a function has both @commands
and @nickname_commands
, they'll both work, because normal PRIVMSGs are acceptable for both of those. Mix @action_commands
in, though, and the other decorator types stop working as expected because of the added ACTION
intent. This should, at minimum, be explicitly called out in the documentation. Ideally we'd make it so all of the command types can be mixed on a single callable, but I think that would require a rework of some internals. Definitely out of scope for this PR, but worth keeping in mind as we continue refining 7.x.
Thing is, having @action_commands
is definitely more useful than not having it, even if there are some potential conflicts with the other decorators. I can personally streamline, at a quick estimate, three or four of my own plugins using this new feature. If my crappy old code from four years ago can use this—so can the Sopel ecosystem at large.
PS: The rebase introduced some whitespace oddities, most (all?) of which I marked with line notes.
44cd95d
to
c0ed170
Compare
That was really odd with the whitespace disappearing from my push. Looked normal in my editor. Added all the requested changes though. |
Hmm, that force-push undid all the changes. You should try rebasing/squashing again from 44cd95d. |
@dgw, something is screwy on my end, and everytime I squash, those whitespaces change. |
ccc49f7
to
9911b97
Compare
I deleted the cloned directory, recloned, squashed, and it looks like the problem went away. Not sure what was happening before, but it looks like everything is there. |
If I'm touching tests, I like @Exirel to look at it. 😁 |
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.
Yeah, the tests are good @dgw
Had to rebase on |
And rebased again due to conflicting changes in #1708. 😦 |
As per my idea in Issue #1658, this is my attempt to integrate an
action_commands
command structure to Sopel.There are still things to work out here, I'm sure. I copied elements I saw in
intents
,commands
, andnickname_commands
. I am very well aware the docstrings will definitely need work, as well as tests added.I'm also not happy with the import line adjusted, and will likely fix that with
()
later.This is more/less a draft PR, but my brief tests were very successful.