Documentation ¶
Overview ¶
Package control 控制插件的启用与优先级等
Index ¶
- Constants
- func CanResponse(gid int64) bool
- func Delete(service string)
- func ExtraFromString(s string) int16
- func ForEachByPrio(iterator func(i int, manager *ctrl.Control[*zero.Ctx]) bool)
- func LoadCustomPriority(m map[string]uint64)
- func Lookup(service string) (*ctrl.Control[*zero.Ctx], bool)
- func Response(gid int64) error
- func Silence(gid int64) error
- type Engine
- func (e *Engine) ApplySingle(s *single.Single[int64]) *Engine
- func (e *Engine) DataFolder() string
- func (e *Engine) Delete()
- func (e *Engine) GetCustomLazyData(dataurl, filename string) ([]byte, error)
- func (e *Engine) GetLazyData(filename string, isDataMustEqual bool) ([]byte, error)
- func (e *Engine) InitWhenNoError(errfun func() error, do func())
- func (e *Engine) IsEnabledIn(id int64) bool
- func (e *Engine) On(typ string, rules ...zero.Rule) *Matcher
- func (e *Engine) OnCommand(commands string, rules ...zero.Rule) *Matcher
- func (e *Engine) OnCommandGroup(commands []string, rules ...zero.Rule) *Matcher
- func (e *Engine) OnFullMatch(src string, rules ...zero.Rule) *Matcher
- func (e *Engine) OnFullMatchGroup(src []string, rules ...zero.Rule) *Matcher
- func (e *Engine) OnKeyword(keyword string, rules ...zero.Rule) *Matcher
- func (e *Engine) OnKeywordGroup(keywords []string, rules ...zero.Rule) *Matcher
- func (e *Engine) OnMessage(rules ...zero.Rule) *Matcher
- func (e *Engine) OnMetaEvent(rules ...zero.Rule) *Matcher
- func (e *Engine) OnNotice(rules ...zero.Rule) *Matcher
- func (e *Engine) OnPrefix(prefix string, rules ...zero.Rule) *Matcher
- func (e *Engine) OnPrefixGroup(prefix []string, rules ...zero.Rule) *Matcher
- func (e *Engine) OnRegex(regexPattern string, rules ...zero.Rule) *Matcher
- func (e *Engine) OnRequest(rules ...zero.Rule) *Matcher
- func (e *Engine) OnShell(command string, model any, rules ...zero.Rule) *Matcher
- func (e *Engine) OnSuffix(suffix string, rules ...zero.Rule) *Matcher
- func (e *Engine) OnSuffixGroup(suffix []string, rules ...zero.Rule) *Matcher
- func (e *Engine) UseMidHandler(rules ...zero.Rule)
- func (e *Engine) UsePostHandler(handler ...zero.Handler)
- func (e *Engine) UsePreHandler(rules ...zero.Rule)
- type Matcher
Constants ¶
const ( // StorageFolder 插件控制数据目录 StorageFolder = "data/control/" // Md5File ... Md5File = StorageFolder + "stor.spb" )
Variables ¶
This section is empty.
Functions ¶
func ExtraFromString ¶ added in v1.7.0
ExtraFromString generate int16 extra key from string's md5
func ForEachByPrio ¶ added in v1.6.0
ForEachByPrio iterates through managers by their priority.
func LoadCustomPriority ¶ added in v1.7.0
LoadCustomPriority 加载自定义优先级 map,适配 1.21 及以上版本
Types ¶
type Engine ¶
type Engine struct {
// contains filtered or unexported fields
}
Engine is the pre_handler, post_handler manager
func AutoRegister ¶ added in v1.7.0
AutoRegister 根据包名自动注册插件
func (*Engine) ApplySingle ¶ added in v1.2.5
ApplySingle 应用反并发
func (*Engine) DataFolder ¶ added in v1.3.0
DataFolder 本插件数据目录, 默认 data/zbp/
func (*Engine) GetCustomLazyData ¶ added in v1.6.0
GetCustomLazyData 下载并获取本 engine 文件夹下的自动定义懒加载数据
func (*Engine) GetLazyData ¶ added in v1.4.0
GetLazyData 下载并获取本 engine 文件夹下的懒加载数据
func (*Engine) InitWhenNoError ¶ added in v1.6.0
InitWhenNoError 在 errfun 无误时执行 do
func (*Engine) IsEnabledIn ¶ added in v1.3.3
IsEnabledIn 自己是否在 id (正群负个人零全局) 启用
func (*Engine) OnCommandGroup ¶
OnCommandGroup 命令触发器组
func (*Engine) OnFullMatch ¶
OnFullMatch 完全匹配触发器
func (*Engine) OnFullMatchGroup ¶
OnFullMatchGroup 完全匹配触发器组
func (*Engine) OnKeywordGroup ¶
OnKeywordGroup 关键词触发器组
func (*Engine) OnMetaEvent ¶
OnMetaEvent 元事件触发器
func (*Engine) OnPrefixGroup ¶
OnPrefixGroup 前缀触发器组
func (*Engine) OnSuffixGroup ¶
OnSuffixGroup 后缀触发器组
func (*Engine) UseMidHandler ¶ added in v1.6.1
UseMidHandler 向该 Engine 添加新 MidHandler(Rule), 会在 Rule 判断后, Matcher 触发前触发,如果 midHandler 没有通过,则 Matcher 不会触发 可用于速率限制等
func (*Engine) UsePostHandler ¶ added in v1.6.1
UsePostHandler 向该 Engine 添加新 PostHandler(Rule), 会在 Matcher 触发后触发,如果 PostHandler 返回 false, 则后续的 post handler 不会触发 可用于反并发等
func (*Engine) UsePreHandler ¶ added in v1.6.1
UsePreHandler 向该 Engine 添加新 PreHandler(Rule), 会在 Rule 判断前触发,如果 preHandler 没有通过,则 Rule, Matcher 不会触发 可用于分群组管理插件等
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
Package webctrl 包含 webui 所需的所有内容
|
Package webctrl 包含 webui 所需的所有内容 |
controller
Package controller 主要处理逻辑
|
Package controller 主要处理逻辑 |
docs
Code generated by swaggo/swag.
|
Code generated by swaggo/swag. |
middleware
Package middleware 中间件
|
Package middleware 中间件 |
model
Package model 用户模型类
|
Package model 用户模型类 |
router
Package router 路由
|
Package router 路由 |
types
Package types 结构体
|
Package types 结构体 |