pepebot/discord/middleware.go

15 lines
350 B
Go
Raw Normal View History

2021-06-03 13:45:07 +02:00
package main
2021-06-04 09:54:28 +02:00
import (
"github.com/bwmarrin/discordgo"
"quenten.nl/pepebot/discord/mux"
)
2021-06-03 13:45:07 +02:00
2021-06-04 09:54:28 +02:00
func (app *application) LogToConsole(next mux.Command) mux.Command {
2021-06-03 13:45:07 +02:00
fn := func(s *discordgo.Session, m *discordgo.MessageCreate) {
2021-06-03 14:07:11 +02:00
app.infoLog.Printf("%s \tsaid: %s\n", m.Author.Username, m.Content)
2021-06-03 13:45:07 +02:00
next.Execute(s, m)
}
2021-06-04 09:54:28 +02:00
return mux.HandlerFunc(fn)
2021-06-03 13:45:07 +02:00
}