Closed numberoverzero closed 7 years ago
Merging #42 into master will increase coverage by
0.53%
. The diff coverage is100%
.
@@ Coverage Diff @@
## master #42 +/- ##
==========================================
+ Coverage 98.77% 99.31% +0.53%
==========================================
Files 5 5
Lines 409 436 +27
Branches 119 119
==========================================
+ Hits 404 433 +29
+ Misses 3 2 -1
+ Partials 2 1 -1
Impacted Files | Coverage Δ | |
---|---|---|
bottom/protocol.py | 94.59% <100%> (+3.48%) |
:arrow_up: |
bottom/client.py | 98.94% <100%> (+0.58%) |
:arrow_up: |
bottom/__init__.py | 100% <100%> (ø) |
:arrow_up: |
Continue to review full report at Codecov.
Legend - Click here to learn more
Δ = absolute <relative> (impact)
,ø = not affected
,? = missing data
Powered by Codecov. Last update dc2b552...cadb738. Read the comment docs.
@DACRepair It's been a while since you opened #32, so there's a good chance you moved on to another library. If you did find a way to make bottom work, I'd love your feedback on the new methods.
I'll let this bake for a week in case anyone else has feedback, after which I'll merge 2.1.0.
2.1.0: Client supports two new methods, roughly analogous to
send
andtrigger
respectively:send_raw(message: str) -> None
handle_raw(message: str) -> None
Additionally, there is now a public attribute
raw_handlers
which is a list of asynchronous functions to invoke duringhandle_raw
. The first function is invoked with the original message and a reference to the next handler; it has full control to send a different message, or not call the next handler at all.The simplest handler would be:
The docs include more complex examples, such as transparently redirecting the message on privmsg, or base64 decoding and decrypting messages before passing them to the underlying rfc2812 handler.
By default,
Client
instances start with an rfc2812 handler. BecauseClient.raw_handlers
is just a list, it can be removed or cleared. Handler order is significant.Other changes:
Client._handlers
has been renamed toClient._event_handlers
as there are now two levels of dispatch. Because the attribute is not public, this is not a major version change.