package useful import ( "context" "tuxpa.in/a/irc/pkg/ircv3" ) type Pong struct { } func (u *Pong) Middleware(next ircv3.Handler) ircv3.Handler { return ircv3.HandlerFunc(func(ctx context.Context, w ircv3.MessageWriter, m *ircv3.Message) { if m.Command == "PING" { w.WriteMessage(ircv3.NewMessage("PONG", m.Param(0))) } next.Handle(ctx, w, m) }) }