birdbot/common/component.go

26 lines
633 B
Go
Raw Normal View History

2023-03-30 23:51:05 -04:00
package common
type Component interface {
Initialize(birdbot ComponentManager) error
}
2023-03-31 20:49:50 +00:00
// ComponentManager is the primary way for a component to interact with BirdBot
// by listening to events and committing actions
2023-03-30 23:51:05 -04:00
type ComponentManager interface {
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
RegisterGameModule(ID string, plugin GameModule) error
2023-03-30 23:51:05 -04:00
}