feat: 群聊中撤回消息 (#520)

This commit is contained in:
jinyunboss 2022-12-10 14:11:26 +08:00 committed by GitHub
parent adfa9f9e0f
commit f96f14052e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 1 deletions

View File

@ -237,7 +237,7 @@ zerobot [-h] [-n nickname] [-t token] [-u url] [-p prefix] [-d|w] [-c|s config.j
- [ ] 同意好友请求
- [ ] 撤回[@xxx] [xxx]
- [x] 对信息回复: 撤回
- [ ] 警告[@xxx]

View File

@ -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) {