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:
@@ -12,8 +12,9 @@ import (
|
||||
func init() {
|
||||
// 在 init 函数中注册多个处理函数(类似 ZeroBot 风格)
|
||||
|
||||
// 处理私聊消息
|
||||
// 处理私聊消息(使用 OnlyPrivate 中间件,虽然 OnPrivateMessage 已经匹配私聊,这里作为示例)
|
||||
engine.OnPrivateMessage().
|
||||
Use(engine.OnlyPrivate()). // 只在私聊中响应
|
||||
Handle(func(ctx context.Context, event protocol.Event, botManager *protocol.BotManager, logger *zap.Logger) error {
|
||||
// 获取消息内容
|
||||
data := event.GetData()
|
||||
|
||||
Reference in New Issue
Block a user