Skip to content

Commit

Permalink
feat: 群聊中撤回消息 (#520)
Browse files Browse the repository at this point in the history
  • Loading branch information
jinyunboss committed Dec 10, 2022
1 parent adfa9f9 commit f96f140
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ zerobot [-h] [-n nickname] [-t token] [-u url] [-p prefix] [-d|w] [-c|s config.j

- [ ] 同意好友请求

- [ ] 撤回[@xxx] [xxx]
- [x] 对信息回复: 撤回

- [ ] 警告[@xxx]

Expand Down
10 changes: 10 additions & 0 deletions plugin/manager/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,16 @@ func init() { // 插件主体
)
ctx.SendChain(message.Text("嗯!不错的头衔呢~"))
})
// 撤回
// 群聊中直接回复消息结尾带上撤回
// 权限够的话,可以把请求撤回的消息也一并撤回
engine.OnRegex(`^\[CQ:reply,id=(-?\d+)\].*撤回$`, zero.AdminPermission, zero.OnlyGroup).SetBlock(true).
Handle(func(ctx *zero.Ctx) {
// 删除需要撤回的消息ID
ctx.DeleteMessage(message.NewMessageIDFromString(ctx.State["regex_matched"].([]string)[1]))
// 删除请求撤回的消息ID
//ctx.DeleteMessage(message.NewMessageIDFromInteger(ctx.Event.MessageID.(int64)))
})
// 群聊转发
engine.OnRegex(`^群聊转发.*?(\d+)\s(.*)`, zero.SuperUserPermission).SetBlock(true).
Handle(func(ctx *zero.Ctx) {
Expand Down

0 comments on commit f96f140

Please sign in to comment.