Documentation
¶
Overview ¶
Package module provides the module handler interface and base types.
Index ¶
- Constants
- func Behavior(uid types.Uid, flag string, number int)
- func Bootstrap() error
- func FormMsg(ctx types.Context, id string) types.MsgPayload
- func Help(rules []any) (map[string][]string, error)
- func Init(jsonconf json.RawMessage) error
- func List() map[string]Handler
- func Register(name string, module Handler)
- func RunCommand(commandRules []command.Rule, ctx types.Context, content any) (types.MsgPayload, error)
- func RunForm(formRules []form.Rule, ctx types.Context, values types.KV) (types.MsgPayload, error)
- func ServiceURL(ctx types.Context, group, path string, param types.KV) string
- func SettingGet(ctx types.Context, id string, key string) (types.KV, error)
- func SettingMsg(ctx types.Context, id string) types.MsgPayload
- func Shortcut(title, link string) (string, error)
- func StoreForm(ctx types.Context, payload types.MsgPayload) types.MsgPayload
- func StoreParameter(params types.KV, expiredAt time.Time) (string, error)
- func Unregister(name string)
- func Webservice(app *fiber.App, name string, ruleset webservice.Ruleset)
- type Base
- func (Base) Bootstrap() error
- func (Base) Command(_ types.Context, _ any) (types.MsgPayload, error)
- func (Base) Form(_ types.Context, _ types.KV) (types.MsgPayload, error)
- func (b Base) Help() (map[string][]string, error)
- func (Base) Input(_ types.Context, _ types.KV, _ any) (types.MsgPayload, error)
- func (Base) Rules() []any
- func (Base) Webservice(_ *fiber.App)
- type Handler
Constants ¶
View Source
const ( MessageBotIncomingBehavior = "message_bot_incoming" MessageGroupIncomingBehavior = "message_group_incoming" )
Variables ¶
This section is empty.
Functions ¶
func Init ¶
func Init(jsonconf json.RawMessage) error
func RunCommand ¶
func SettingMsg ¶
func SettingMsg(ctx types.Context, id string) types.MsgPayload
func StoreForm ¶
func StoreForm(ctx types.Context, payload types.MsgPayload) types.MsgPayload
func Unregister ¶
func Unregister(name string)
Unregister removes a previously registered module handler. It is a no-op if the name is not found. Intended primarily for test teardown.
func Webservice ¶
func Webservice(app *fiber.App, name string, ruleset webservice.Ruleset)
Types ¶
type Handler ¶
type Handler interface {
// Init initializes the module.
Init(jsonconf json.RawMessage) error
// IsReady checks if the module is initialized.
IsReady() bool
// Bootstrap Lifecycle hook
Bootstrap() error
// Help return module help
Help() (map[string][]string, error)
// Rules return module ruleset
Rules() []any
// Input return input result
Input(ctx types.Context, head types.KV, content any) (types.MsgPayload, error)
// Command return module result
Command(ctx types.Context, content any) (types.MsgPayload, error)
// Form return module form result
Form(ctx types.Context, values types.KV) (types.MsgPayload, error)
// Webservice return webservice routes
Webservice(app *fiber.App)
}
Click to show internal directories.
Click to hide internal directories.