refactor: 重构handler系统

This commit is contained in:
lixiangwuxian
2024-10-20 02:40:02 +08:00
parent 6dad9bb76f
commit 03ee846b7a
4 changed files with 26 additions and 9 deletions

12
model/handler.go Normal file
View File

@@ -0,0 +1,12 @@
package model
import "git.lxtend.com/qqbot/constants"
type Handler func(msg Message) (reply Reply)
type TryCatchHandler func(msg Message) (reply Reply, catched bool)
type HandlerInfo[H Handler | TryCatchHandler] struct {
Trigger string
Handler H
Level constants.PermissionLevel
}