mirror of
https://github.com/FloatTech/ZeroBot-Plugin.git
synced 2026-02-12 18:20:27 +00:00
新增统计睡眠时间和添加协程里的异常捕获 (#84)
* fix:捕获协程异常 * feat:添加睡眠时间 * feat:添加睡眠管理功能 * fix:修改对标时间 * fix:修改注释函数名,使用一个时间 * feat:让大家能够更加清楚的看到每一个功能 * feat:把群管放在control,增加退群信息 * fix:不会recover * fix:原本的正则限制机器人回复回复的消息,故去掉正则 * fix:添加服务详情,整理manager * feat:chat进control Co-authored-by: Guohuiyuan <haibaraguo@yeahka.com>
This commit is contained in:
@@ -32,14 +32,14 @@ func init() { // 插件主体
|
||||
Help: "青云客\n" +
|
||||
"- @Bot 任意文本(任意一句话回复)",
|
||||
})
|
||||
// 回复 匹配中文、英文、数字、空格但不包括下划线等符号
|
||||
engine.OnRegex("^([\u4E00-\u9FA5A-Za-z0-9\\s]{1,30})", zero.OnlyToMe).SetBlock(true).SetPriority(prio).
|
||||
// 回复 @和包括名字
|
||||
engine.OnMessage(zero.OnlyToMe).SetBlock(true).SetPriority(prio).
|
||||
Handle(func(ctx *zero.Ctx) {
|
||||
if !bucket.Load(ctx.Event.UserID).Acquire() {
|
||||
// 频繁触发,不回复
|
||||
return
|
||||
}
|
||||
msg := ctx.State["regex_matched"].([]string)[1]
|
||||
msg := ctx.ExtractPlainText()
|
||||
// 调用青云客接口
|
||||
reply, err := getMessage(msg)
|
||||
if err != nil {
|
||||
|
||||
@@ -1,21 +0,0 @@
|
||||
package qingyunke
|
||||
|
||||
// TODO: 移动到 manager 搭配自动验证使用
|
||||
|
||||
/*
|
||||
import (
|
||||
zero "github.com/wdvxdr1123/ZeroBot"
|
||||
)
|
||||
|
||||
//自动同意加群,加好友
|
||||
func init() {
|
||||
zero.OnRequest().SetBlock(false).FirstPriority().Handle(func(ctx *zero.Ctx) {
|
||||
if ctx.Event.RequestType == "friend" {
|
||||
ctx.SetFriendAddRequest(ctx.Event.Flag, true, "")
|
||||
}
|
||||
if ctx.Event.RequestType == "group" && ctx.Event.SubType == "invite" {
|
||||
ctx.SetGroupAddRequest(ctx.Event.Flag, "invite", true, "我爱你,mua~")
|
||||
}
|
||||
})
|
||||
}
|
||||
*/
|
||||
Reference in New Issue
Block a user