package main import ( "bufio" "os" "strings" "time" _ "github.com/cdle/sillyplus/adapters/qq" _ "github.com/cdle/sillyplus/adapters/web" "github.com/cdle/sillyplus/core" "github.com/cdle/sillyplus/utils" ) var sillyplus = core.MakeBucket("sillyplus") func main() { loc, _ := time.LoadLocation("Asia/Shanghai") time.Local = loc core.Init() if sillyplus.GetBool("anti_kasi") { go utils.MonitorGoroutine() } d := false for _, arg := range os.Args { if arg == "-d" { d = true } if arg == "-r" { //准备程序->原程序 rfix := ".ready.exe" ofix := ".exe" if strings.Contains(os.Args[0], rfix) { err := utils.CopyFile(utils.ProcessName, strings.Replace(utils.ProcessName, rfix, ofix, -1)) if err == nil { utils.Daemon("reset") } } else { os.Remove(strings.ReplaceAll(os.Args[0], ofix, rfix)) } continue } } if !d { t := false for _, arg := range os.Args { if arg == "-t" { t = true } } if t { core.Logs.Info("Terminal机器人已连接") scanner := bufio.NewScanner(os.Stdin) for scanner.Scan() { data := scanner.Text() f := &core.Faker{ Type: "terminal", Message: string(data), Admin: true, } core.Messages <- f } core.Logs.Info("Terminal机器人异常,请检查运行环境设置,如果是docker环境,请附加-it参数") } else { // core.Logs.Info("Terminal机器人不可用,运行带-t参数即可启用") } } select {} } //