aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/test/example_rule.json
blob: 73abe3fe1ad4232709b9a482627543a076eaf292 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
{
  // 匹配日志元数据,提取 id、QQ 账号和时间。例如:墨勒托.DW(1571806261) 2025-01-27 19:58:15
  "metadata": {
    "type": "metadata",
    "patterns": [
      "^(\\S+)\\((\\d+)\\)\\s+(\\d{4}-\\d{2}-\\d{2} \\d{2}:\\d{2}:\\d{2})"
    ],
    "groups": ["user_name", "user_id", "time"]
  },
  "content": [
    {
      "type": "action",
      "match_type": "prefix",
      "priority": 1001, // 优先级,数字越小优先级越高,范围为1-5000
      "patterns": ["^#(.+)"],
      "groups": ["action_content"]
    },
    {
      "type": "speech",
      "match_type": "enclosed",
      "priority": 101,
      "patterns": [
        "[“”\"](.+?)[“”\"]" // 匹配各种引号
      ],
      "groups": ["speech_content"]
    },
    {
      "type": "ooc_speech",
      "match_type": "enclosed",
      "priority": 103,
      "patterns": [
        "[\\((](.+?)[\\))]" // 匹配各种括号
      ],
      "groups": ["ooc_content"]
    },
    {
      "type": "suffix_ooc_speech",
      "match_type": "suffix",
      "priority": 2001,
      "patterns": ["(.+)b$"],
      "groups": ["suffix_ooc_speech"]
    },
    {
      "type": "dice_order",
      "match_type": "prefix",
      "priority": 1,
      "patterns": ["^[.。](.+)"],
      "groups": ["dice_command"]
    },
    {
      "type": "thought",
      "match_type": "enclosed",
      "priority": 102,
      "patterns": ["【(.+)】"],
      "groups": ["thought_content"]
    }
  ]
}