1 Star 0 Fork 0

csingo/cCommand

加入 Gitee
与超过 1400万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
Component.go 945 Bytes
一键复制 编辑 原始数据 按行查看 历史
joe 提交于 2025-01-15 16:40 +08:00 . update
package cCommand
import (
"github.com/robfig/cron/v3"
"gitee.com/csingo/cComponents"
)
type CommandComponent struct{}
func (i *CommandComponent) Inject(instance any) bool {
if container.Is(instance) {
return container.Save(instance)
}
return false
}
func (i *CommandComponent) InjectConf(config cComponents.ConfigInterface) bool {
if config.ConfigName() == CommandConfigName {
command_config = config.(*CommandConf)
container.UpdateCommands()
return true
}
return false
}
func (i *CommandComponent) Load() {
exec()
if !command_config.Enable {
return
}
// 创建定时器
container.cron = cron.New(
cron.WithSeconds(),
cron.WithChain(
cron.Recover(cron.DefaultLogger),
),
)
// 任务分发执行
dispatch()
// 清除已停止的任务
go clears()
}
func (i *CommandComponent) Listen() []*cComponents.ConfigListener {
return []*cComponents.ConfigListener{}
}
var Component = &CommandComponent{}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Go
1
https://gitee.com/csingo/cCommand.git
git@gitee.com:csingo/cCommand.git
csingo
cCommand
cCommand
v0.4.11

搜索帮助