Skip to content

Commit

Permalink
MiddlewarePoller's Filter field is now exported.
Browse files Browse the repository at this point in the history
  • Loading branch information
Ian Byrd committed Dec 10, 2017
1 parent 0e5915f commit ea69d21
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions poller.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,17 +28,16 @@ type Poller interface {
// For heavy middleware, use increased capacity.
//
type MiddlewarePoller struct {
Poller Poller
filter func(*Update) bool

Capacity int // Default: 1
Poller Poller
Filter func(*Update) bool
}

// NewMiddlewarePoller wait for it... constructs a new middleware poller.
func NewMiddlewarePoller(original Poller, filter func(*Update) bool) *MiddlewarePoller {
return &MiddlewarePoller{
Poller: original,
filter: filter,
Filter: filter,
}
}

Expand Down Expand Up @@ -66,7 +65,7 @@ func (p *MiddlewarePoller) Poll(b *Bot, dest chan Update, stop chan struct{}) {
return

case upd := <-middle:
if p.filter(&upd) {
if p.Filter(&upd) {
dest <- upd
}
}
Expand Down

0 comments on commit ea69d21

Please sign in to comment.