2023-03-30 23:51:05 -04:00
|
|
|
package common
|
|
|
|
|
2023-04-01 01:23:37 -04:00
|
|
|
type Module interface {
|
|
|
|
Initialize(birdbot ModuleManager) error
|
2023-03-30 23:51:05 -04:00
|
|
|
}
|
|
|
|
|
2023-04-01 01:23:37 -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
|
2023-04-01 01:23:37 -04:00
|
|
|
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)
|
|
|
|
|
2023-06-17 23:33:35 +00:00
|
|
|
// Submodules
|
|
|
|
RegisterExternalChat(channelID string, chat ExternalChatModule) error
|
2023-03-30 23:51:05 -04:00
|
|
|
}
|