irc/plugins/useful/pong.go

18 lines
333 B
Go
Raw Normal View History

2024-05-14 05:58:51 +00:00
package useful
import (
"tuxpa.in/a/irc/pkg/ircv3"
)
type Pong struct {
}
func (u *Pong) Middleware(next ircv3.Handler) ircv3.Handler {
2024-05-15 09:28:02 +00:00
return ircv3.HandlerFunc(func(w ircv3.MessageWriter, e *ircv3.Event) {
if e.Msg.Command == "PING" {
w.WriteMessage(ircv3.NewMessage("PONG", e.Msg.Param(0)))
2024-05-14 05:58:51 +00:00
}
2024-05-15 09:28:02 +00:00
next.Handle(w, e)
2024-05-14 05:58:51 +00:00
})
}