1
0
mirror of https://github.com/fumiama/ReiBot.git synced 2026-06-10 21:24:33 +08:00

add all resp/sil

This commit is contained in:
源文雨
2022-07-08 21:33:13 +08:00
parent ac54e24468
commit 84e9687983
3 changed files with 33 additions and 2 deletions

26
rule.go
View File

@@ -55,6 +55,32 @@ func init() {
_, _ = ctx.Caller.Send(tgba.NewMessage(ctx.Message.Chat.ID, msg))
})
OnMessageCommandGroup([]string{
"全局响应", "allresponse", "全局沉默", "allsilence",
}, SuperUserPermission).SetBlock(true).secondPriority().Handle(func(ctx *Ctx) {
msg := ""
cmd := ctx.State["command"].(string)
switch {
case strings.Contains(cmd, "响应") || strings.Contains(cmd, "response"):
err := m.Response(0)
if err == nil {
msg = ctx.Caller.Self.String() + "将开始在此工作啦~"
} else {
msg = "ERROR: " + err.Error()
}
case strings.Contains(cmd, "沉默") || strings.Contains(cmd, "silence"):
err := m.Silence(0)
if err == nil {
msg = ctx.Caller.Self.String() + "将开始休息啦~"
} else {
msg = "ERROR: " + err.Error()
}
default:
msg = "ERROR: bad command\"" + cmd + "\""
}
_, _ = ctx.Caller.Send(tgba.NewMessage(ctx.Message.Chat.ID, msg))
})
OnMessageCommandGroup([]string{
"启用", "enable", "禁用", "disable",
}, UserOrGrpAdmin).SetBlock(true).secondPriority().Handle(func(ctx *Ctx) {