mirror of
https://github.com/Luzifer/twitch-bot.git
synced 2024-12-20 11:51:17 +00:00
[core] Allow plugins to evaluate whether permissions are available
Signed-off-by: Knut Ahlers <knut@ahlers.me>
This commit is contained in:
parent
a06d8fa1cd
commit
29ce8820bf
2 changed files with 9 additions and 0 deletions
|
@ -33,6 +33,9 @@ type (
|
|||
|
||||
ActorDocumentationRegistrationFunc func(ActionDocumentation)
|
||||
|
||||
ChannelPermissionCheckFunc func(channel string, scopes ...string) (bool, error)
|
||||
ChannelAnyPermissionCheckFunc func(channel string, scopes ...string) (bool, error)
|
||||
|
||||
CronRegistrationFunc func(spec string, cmd func()) (cron.EntryID, error)
|
||||
|
||||
EventHandlerFunc func(evt string, eventData *FieldCollection) error
|
||||
|
@ -64,6 +67,10 @@ type (
|
|||
GetTwitchClient func() *twitch.Client
|
||||
// GetTwitchClientForChannel retrieves a fully configured Twitch client with initialized cache for extended permission channels
|
||||
GetTwitchClientForChannel func(string) (*twitch.Client, error)
|
||||
// HasAnyPermissionForChannel checks whether ANY of the given permissions were granted for the given channel
|
||||
HasAnyPermissionForChannel ChannelAnyPermissionCheckFunc
|
||||
// HasPermissionForChannel checks whether ALL of the given permissions were granted for the given channel
|
||||
HasPermissionForChannel ChannelPermissionCheckFunc
|
||||
// RegisterActor is used to register a new IRC rule-actor implementing the Actor interface
|
||||
RegisterActor ActorRegistrationFunc
|
||||
// RegisterActorDocumentation is used to register an ActorDocumentation for the config editor
|
||||
|
|
|
@ -126,6 +126,8 @@ func getRegistrationArguments() plugins.RegistrationArguments {
|
|||
GetDatabaseConnector: func() database.Connector { return db },
|
||||
GetLogger: func(moduleName string) *log.Entry { return log.WithField("module", moduleName) },
|
||||
GetTwitchClient: func() *twitch.Client { return twitchClient },
|
||||
HasAnyPermissionForChannel: accessService.HasAnyPermissionForChannel,
|
||||
HasPermissionForChannel: accessService.HasPermissionsForChannel,
|
||||
RegisterActor: registerAction,
|
||||
RegisterActorDocumentation: registerActorDocumentation,
|
||||
RegisterAPIRoute: registerRoute,
|
||||
|
|
Loading…
Reference in a new issue