Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Beta445 #445

Merged
merged 16 commits into from
Jun 29, 2024
18 changes: 18 additions & 0 deletions handlers/send_group_msg.go
Original file line number Diff line number Diff line change
Expand Up @@ -1543,6 +1543,24 @@ func auto_md(message callapi.ActionMessage, messageText string, richMediaMessage
}
}

//在虚拟二级指令白名单,设置@前缀,代表仅触发其本身
//如果@前缀指令包含了空格 则只显示和应用空格右侧的文本
if strings.HasPrefix(whiteLabel, "@") {
// 移除whiteLabel前端的"@"
whiteLabel = strings.TrimPrefix(whiteLabel, "@")
// 找到最后一个空格的位置
lastSpaceIndex := strings.LastIndex(whiteLabel, " ")
if lastSpaceIndex != -1 {
// 先存储空格左侧的字符串到dataLabel
dataLabel = whiteLabel[:lastSpaceIndex]
// 然后更新whiteLabel为空格右侧的子字符串
whiteLabel = whiteLabel[lastSpaceIndex+1:]
} else {
// 如果没有找到空格,将整个字符串赋给dataLabel
dataLabel = whiteLabel
}
}

var actiontype keyboard.ActionType
var permission *keyboard.Permission
var actiondata string
Expand Down
16 changes: 13 additions & 3 deletions idmap/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,9 +113,15 @@ func CleanBucket(bucketName string) {
return fmt.Errorf("bucket %s not found", bucketName)
}

// 遍历并检查id的长度
// 使用游标遍历bucket
c := b.Cursor()
for k, v := c.First(); k != nil; k, v = c.Next() {
// 检查键或值是否包含冒号
if bytes.Contains(k, []byte(":")) || bytes.Contains(v, []byte(":")) {
continue // 忽略包含冒号的键值对
}

// 检查值id的长度
id := string(v)
if len(id) != 32 {
if err := c.Delete(); err != nil {
Expand All @@ -125,9 +131,13 @@ func CleanBucket(bucketName string) {
}
}

// 遍历并检查reverseKey的长度
for k, _ := c.First(); k != nil; k, _ = c.Next() {
// 再次遍历处理reverseKey的情况
for k, v := c.First(); k != nil; k, v = c.Next() {
if strings.HasPrefix(string(k), "row-") {
if bytes.Contains(k, []byte(":")) || bytes.Contains(v, []byte(":")) {
continue // 忽略包含冒号的键值对
}

id := string(b.Get(k))
if len(id) != 32 {
if err := b.Delete(k); err != nil {
Expand Down
Loading