fix: keep only setting command entries

This commit is contained in:
姚章浩
2026-08-14 12:35:33 +08:00
parent 19ed4b50df
commit 18c81232ce
4 changed files with 24 additions and 16 deletions
+2 -2
View File
@@ -29,13 +29,13 @@ func TestDetermineState(t *testing.T) {
}
func TestParseCommandStrict(t *testing.T) {
yes := []string{"/setting", "//setting", "/settings", "/设置", "/help", "//help", "/setting 123456", "/setting language ja", "//setting language en", "/setting support", "/setting question https://alidocs.dingtalk.com/i/nodes/abc"}
yes := []string{"/setting", "/设置", "/setting 123456", "/设置 123456", "/setting language ja", "/设置 language ja", "/setting support", "/设置 question https://alidocs.dingtalk.com/i/nodes/abc"}
for _, raw := range yes {
if c, ok := ParseCommand(raw); !ok || c.Name == "" {
t.Fatalf("must match %q", raw)
}
}
no := []string{"如何设置机器人", "abc /setting", "请解释/setting", "/settiing"}
no := []string{"/help", "//help", "/settings", "//setting", "如何设置机器人", "abc /setting", "请解释/setting", "/settiing"}
for _, raw := range no {
if _, ok := ParseCommand(raw); ok {
t.Fatalf("must not match %q", raw)