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-04-01 01:23:37 -04:00
|
|
|
RegisterChatSyncModule(ID string, plugin ChatSyncModule) error
|
2023-03-30 23:51:05 -04:00
|
|
|
}
|