lrstanley / girc

:bomb: girc is a flexible IRC library for Go :ok_hand:
https://pkg.go.dev/github.com/lrstanley/girc
MIT License
137 stars 13 forks source link

Add a method for converting an Event to a CTCPEvent #20

Closed nmeum closed 5 years ago

nmeum commented 5 years ago

I want to solve the following problem with the changes purposed here: I have a handler for the ALL_EVENTS command. In this handler I would like to ignore CTCP messages. In order to do that I need to find out if a given girc.Event is a CTCP. This currently doesn't seem to be possible.

girc internally uses the decodeCTCP function for this purpose. Unfortunately, this is not exported. This PR therefore adds a CTCP() function to the girc.Event which calls decodeCTCP.

I don't know if that's the best way to solve the problem I laid out above and I don't know why the decodeCTCP function wasn't exported in the first place. It might also make sense to entirely replace the decodeCTCP function with the CTCP() function I purposed in this PR.

codecov-io commented 5 years ago

Codecov Report

Merging #20 into master will decrease coverage by 0.13%. The diff coverage is 0%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #20      +/-   ##
==========================================
- Coverage   56.35%   56.22%   -0.14%     
==========================================
  Files          13       13              
  Lines        2321     2323       +2     
==========================================
- Hits         1308     1306       -2     
- Misses        908      911       +3     
- Partials      105      106       +1
Impacted Files Coverage Δ
event.go 66.78% <0%> (-0.5%) :arrow_down:
conn.go 58.84% <0%> (-0.83%) :arrow_down:

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 0fb5b68...14cba0b. Read the comment docs.