mirror of
https://github.com/FloatTech/ZeroBot-Plugin.git
synced 2025-12-20 06:20:08 +08:00
✨ 🐛 job禁止递归触发&增加README
This commit is contained in:
parent
1ba4722fc7
commit
156e9f07ad
14
README.md
14
README.md
@ -72,6 +72,20 @@ zerobot [-h] [-t token] [-u url] [-n nickname] [-p prefix] [-d|w] [-g 监听地
|
|||||||
- [x] 查看所有触发指令
|
- [x] 查看所有触发指令
|
||||||
- [x] 查看在"cron"触发的指令
|
- [x] 查看在"cron"触发的指令
|
||||||
- [x] 注入指令结果:任意指令
|
- [x] 注入指令结果:任意指令
|
||||||
|
- 一些示例
|
||||||
|
> 定时指令触发器编程实现每日9:30推送摸鱼人日历示例
|
||||||
|
```
|
||||||
|
记录在"30 9 * * *"触发的指令
|
||||||
|
run[CQ:image,file=https://api.vvhan.com/api/moyu]
|
||||||
|
```
|
||||||
|
> 定时指令触发器编程实现每日12:00以1/2概率执行coser指令
|
||||||
|
```python
|
||||||
|
记录在"0 12 * * *"触发的指令
|
||||||
|
注入指令结果:>runcoderaw py
|
||||||
|
from random import random
|
||||||
|
if random() > 0.5: print('coser')
|
||||||
|
else: print('今天没有coser哦~')
|
||||||
|
```
|
||||||
- **聊天** `import _ "github.com/FloatTech/ZeroBot-Plugin/plugin/chat"`
|
- **聊天** `import _ "github.com/FloatTech/ZeroBot-Plugin/plugin/chat"`
|
||||||
- [x] [BOT名字]
|
- [x] [BOT名字]
|
||||||
- [x] [戳一戳BOT]
|
- [x] [戳一戳BOT]
|
||||||
|
|||||||
@ -153,6 +153,10 @@ func init() {
|
|||||||
if err == nil {
|
if err == nil {
|
||||||
logrus.Debugln("[job] CallerHook returned")
|
logrus.Debugln("[job] CallerHook returned")
|
||||||
id := message.NewMessageID(rsp.Data.Get("message_id").String())
|
id := message.NewMessageID(rsp.Data.Get("message_id").String())
|
||||||
|
if id.ID() == 0 {
|
||||||
|
ctx.SendChain(message.Text("ERROR:未获取到返回结果"))
|
||||||
|
return
|
||||||
|
}
|
||||||
msg := ctx.GetMessage(id)
|
msg := ctx.GetMessage(id)
|
||||||
ctx.Event.NativeMessage = json.RawMessage("\"" + msg.Elements.String() + "\"")
|
ctx.Event.NativeMessage = json.RawMessage("\"" + msg.Elements.String() + "\"")
|
||||||
ctx.Event.RawMessageID = json.RawMessage(msg.MessageId.String())
|
ctx.Event.RawMessageID = json.RawMessage(msg.MessageId.String())
|
||||||
@ -171,7 +175,7 @@ func init() {
|
|||||||
inject(ctx.Event.SelfID, vev)()
|
inject(ctx.Event.SelfID, vev)()
|
||||||
cl()
|
cl()
|
||||||
}
|
}
|
||||||
})).Echo([]byte(strings.ReplaceAll(ctx.Event.RawEvent.Raw, "\"注入指令结果:", "\"")))
|
})).Echo([]byte(strings.ReplaceAll(ctx.Event.RawEvent.Raw, "注入指令结果:", "")))
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user