-
Notifications
You must be signed in to change notification settings - Fork 28
/
tyt.go
51 lines (48 loc) · 1.17 KB
/
tyt.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
package jd_cookie
import (
"fmt"
"strings"
"github.com/cdle/sillyGirl/core"
"github.com/cdle/sillyGirl/develop/qinglong"
)
func initTyt() {
core.AddCommand("", []core.Function{
{
Rules: []string{`raw packetId=(\S+)(&|&)currentActId`},
Admin: true,
Handle: func(s core.Sender) interface{} {
if s.GetImType() == "tg" {
return nil //文明用语
}
err, qls := qinglong.QinglongSC(s)
if err != nil {
return err
}
crons, err := qinglong.GetCrons(qls[0], "")
if err != nil {
return err
}
for _, cron := range crons {
if strings.Contains(cron.Name, "推一推") {
if cron.Status == 0 { //修复错误
return "推一推已在运行中。"
}
err := qinglong.SetConfigEnv(qls[0], qinglong.Env{
Name: "tytpacketId",
Value: s.Get(),
Status: 3,
})
if err != nil {
return err
}
if _, err := qinglong.Req(qls[0], qinglong.CRONS, qinglong.PUT, "/run", []byte(fmt.Sprintf(`["%s"]`, cron.ID))); err != nil {
return err
}
return "推一推起来啦。"
}
}
return "推一推不知道为啥推不动了。"
},
},
})
}