Skip to content

Commit

Permalink
Merge 5b9ea40 into cc741d3
Browse files Browse the repository at this point in the history
  • Loading branch information
Hoshinonyaruko authored Jun 29, 2024
2 parents cc741d3 + 5b9ea40 commit f9f5fa4
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 3 deletions.
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

0 comments on commit f9f5fa4

Please sign in to comment.