mirror of
https://github.com/Luzifer/twitch-bot.git
synced 2024-11-10 01:00:05 +00:00
Expose TwitchClient to plugins
Signed-off-by: Knut Ahlers <knut@ahlers.me>
This commit is contained in:
parent
0a8bf4db0d
commit
44673eadd2
2 changed files with 5 additions and 0 deletions
|
@ -11,6 +11,7 @@ import (
|
||||||
"github.com/Luzifer/twitch-bot/internal/actors/timeout"
|
"github.com/Luzifer/twitch-bot/internal/actors/timeout"
|
||||||
"github.com/Luzifer/twitch-bot/internal/actors/whisper"
|
"github.com/Luzifer/twitch-bot/internal/actors/whisper"
|
||||||
"github.com/Luzifer/twitch-bot/plugins"
|
"github.com/Luzifer/twitch-bot/plugins"
|
||||||
|
"github.com/Luzifer/twitch-bot/twitch"
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
log "github.com/sirupsen/logrus"
|
log "github.com/sirupsen/logrus"
|
||||||
)
|
)
|
||||||
|
@ -59,6 +60,7 @@ func getRegistrationArguments() plugins.RegistrationArguments {
|
||||||
return plugins.RegistrationArguments{
|
return plugins.RegistrationArguments{
|
||||||
FormatMessage: formatMessage,
|
FormatMessage: formatMessage,
|
||||||
GetLogger: func(moduleName string) *log.Entry { return log.WithField("module", moduleName) },
|
GetLogger: func(moduleName string) *log.Entry { return log.WithField("module", moduleName) },
|
||||||
|
GetTwitchClient: func() *twitch.Client { return twitchClient },
|
||||||
RegisterActor: registerAction,
|
RegisterActor: registerAction,
|
||||||
RegisterAPIRoute: registerRoute,
|
RegisterAPIRoute: registerRoute,
|
||||||
RegisterCron: cronService.AddFunc,
|
RegisterCron: cronService.AddFunc,
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
package plugins
|
package plugins
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"github.com/Luzifer/twitch-bot/twitch"
|
||||||
"github.com/go-irc/irc"
|
"github.com/go-irc/irc"
|
||||||
"github.com/robfig/cron/v3"
|
"github.com/robfig/cron/v3"
|
||||||
log "github.com/sirupsen/logrus"
|
log "github.com/sirupsen/logrus"
|
||||||
|
@ -40,6 +41,8 @@ type (
|
||||||
FormatMessage MsgFormatter
|
FormatMessage MsgFormatter
|
||||||
// GetLogger returns a sirupsen log.Entry pre-configured with the module name
|
// GetLogger returns a sirupsen log.Entry pre-configured with the module name
|
||||||
GetLogger LoggerCreationFunc
|
GetLogger LoggerCreationFunc
|
||||||
|
// GetTwitchClient retrieves a fully configured Twitch client with initialized cache
|
||||||
|
GetTwitchClient func() *twitch.Client
|
||||||
// RegisterActor is used to register a new IRC rule-actor implementing the Actor interface
|
// RegisterActor is used to register a new IRC rule-actor implementing the Actor interface
|
||||||
RegisterActor ActorRegistrationFunc
|
RegisterActor ActorRegistrationFunc
|
||||||
// RegisterAPIRoute registers a new HTTP handler function including documentation
|
// RegisterAPIRoute registers a new HTTP handler function including documentation
|
||||||
|
|
Loading…
Reference in a new issue