mirror of
https://github.com/Luzifer/twitch-bot.git
synced 2024-11-09 16:50:01 +00:00
47 lines
1.5 KiB
Go
47 lines
1.5 KiB
Go
package main
|
|
|
|
import (
|
|
"fmt"
|
|
|
|
"github.com/Luzifer/twitch-bot/internal/actors/ban"
|
|
"github.com/Luzifer/twitch-bot/internal/actors/delay"
|
|
deleteactor "github.com/Luzifer/twitch-bot/internal/actors/delete"
|
|
"github.com/Luzifer/twitch-bot/internal/actors/raw"
|
|
"github.com/Luzifer/twitch-bot/internal/actors/respond"
|
|
"github.com/Luzifer/twitch-bot/internal/actors/timeout"
|
|
"github.com/Luzifer/twitch-bot/internal/actors/whisper"
|
|
"github.com/Luzifer/twitch-bot/plugins"
|
|
"github.com/gorilla/mux"
|
|
log "github.com/sirupsen/logrus"
|
|
)
|
|
|
|
var coreActorRegistations = []plugins.RegisterFunc{
|
|
ban.Register,
|
|
delay.Register,
|
|
deleteactor.Register,
|
|
raw.Register,
|
|
respond.Register,
|
|
timeout.Register,
|
|
whisper.Register,
|
|
}
|
|
|
|
func init() {
|
|
args := getRegistrationArguments()
|
|
for _, rf := range coreActorRegistations {
|
|
if err := rf(args); err != nil {
|
|
log.WithError(err).Fatal("Unable to register core actor")
|
|
}
|
|
}
|
|
}
|
|
|
|
func getRegistrationArguments() plugins.RegistrationArguments {
|
|
return plugins.RegistrationArguments{
|
|
FormatMessage: formatMessage,
|
|
GetHTTPRouter: func(name string) *mux.Router { return router.PathPrefix(fmt.Sprintf("/%s/", name)).Subrouter() },
|
|
GetLogger: func(moduleName string) *log.Entry { return log.WithField("module", moduleName) },
|
|
RegisterActor: registerAction,
|
|
RegisterCron: cronService.AddFunc,
|
|
RegisterTemplateFunction: tplFuncs.Register,
|
|
SendMessage: sendMessage,
|
|
}
|
|
}
|