birdbot/common/module.go

30 lines
748 B
Go
Raw Normal View History

2023-03-30 23:51:05 -04:00
package common
type Module interface {
Initialize(birdbot ModuleManager) error
2023-03-30 23:51:05 -04:00
}
// ModuleManager is the primary way for a module to interact with BirdBot
2023-03-31 20:49:50 +00:00
// by listening to events and committing actions
type ModuleManager interface {
2023-03-30 23:51:05 -04:00
OnReady(func() error) error
OnNotify(func(string) error) error
// Event events
OnEventCreate(func(Event) error) error
OnEventDelete(func(Event) error) error
OnEventUpdate(func(Event) error) error
OnEventComplete(func(Event) error) error
2023-03-31 20:49:50 +00:00
// Actions
2023-03-30 23:51:05 -04:00
CreateEvent(event Event) error
Notify(message string) error
2023-03-31 20:49:50 +00:00
2023-06-16 02:08:29 +00:00
// Commands
RegisterCommand(string, ChatCommandConfiguration, func(User, map[string]any) string)
// Submodules
RegisterExternalChat(channelID string, chat ExternalChatModule) error
2023-03-30 23:51:05 -04:00
}