noot
This commit is contained in:
parent
2aa412afee
commit
694e03ae13
|
@ -1 +1,2 @@
|
|||
.env
|
||||
.idea
|
||||
|
|
|
@ -7,12 +7,13 @@ import (
|
|||
"os"
|
||||
"time"
|
||||
|
||||
"tuxpa.in/a/irc/plugins/caps/ircmw"
|
||||
|
||||
_ "github.com/joho/godotenv/autoload"
|
||||
"github.com/lmittmann/tint"
|
||||
"go.uber.org/fx"
|
||||
"go.uber.org/fx/fxevent"
|
||||
"tuxpa.in/a/irc/pkg/ircconn"
|
||||
"tuxpa.in/a/irc/pkg/ircmw"
|
||||
"tuxpa.in/a/irc/pkg/ircv3"
|
||||
"tuxpa.in/a/irc/plugins/auth"
|
||||
"tuxpa.in/a/irc/plugins/useful"
|
||||
|
@ -49,6 +50,7 @@ func exec(log *slog.Logger) error {
|
|||
(&auth.User{Username: "lain", Realname: "lain a", Hostname: "wired", Server: "wired"}).Middleware,
|
||||
ircmw.CapabilityServerTime,
|
||||
(&useful.Autojoin{Channels: []string{"#lainmaxxing"}}).Middleware,
|
||||
(&useful.Pong{}).Middleware,
|
||||
).Handler(ircv3.HandlerFunc(func(ctx context.Context, w ircv3.MessageWriter, m *ircv3.Message) {
|
||||
}))
|
||||
|
||||
|
|
|
@ -3,8 +3,8 @@ package auth
|
|||
import (
|
||||
"context"
|
||||
"encoding/base64"
|
||||
"tuxpa.in/a/irc/plugins/caps/ircmw"
|
||||
|
||||
"tuxpa.in/a/irc/pkg/ircmw"
|
||||
"tuxpa.in/a/irc/pkg/ircv3"
|
||||
)
|
||||
|
||||
|
|
|
@ -0,0 +1,19 @@
|
|||
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)
|
||||
})
|
||||
}
|
Loading…
Reference in New Issue