feat: enhance event handling and add scheduling capabilities

- Introduced a new scheduler to manage timed tasks within the event dispatcher.
- Updated the dispatcher to support the new scheduler, allowing for improved event processing.
- Enhanced action serialization in the OneBot11 adapter to convert message chains to the appropriate format.
- Added new dependencies for cron scheduling and other indirect packages in go.mod and go.sum.
- Improved logging for event publishing and handler matching, providing better insights during execution.
- Refactored plugin loading to include scheduled job management.
This commit is contained in:
lafay
2026-01-05 04:33:30 +08:00
parent d16261e6bd
commit 64cd81b7f1
14 changed files with 2130 additions and 27 deletions

View File

@@ -227,9 +227,23 @@ func (a *Adapter) SerializeAction(action protocol.Action) ([]byte, error) {
zap.String("hint", "This action type may not be supported by OneBot11"))
}
// 复制参数并转换消息链
params := make(map[string]interface{})
for k, v := range action.GetParams() {
// 检查是否是消息链
if k == "message" {
if chain, ok := v.(protocol.MessageChain); ok {
// 转换为 OneBot11 格式
params[k] = ConvertMessageChainToOB11(chain)
continue
}
}
params[k] = v
}
ob11Action := &OB11Action{
Action: ob11ActionName,
Params: action.GetParams(),
Params: params,
}
return sonic.Marshal(ob11Action)