fix: ignore non-command telegram group messages

This commit is contained in:
ShukeBta
2026-05-30 03:04:30 +08:00
parent f8ef35c8e1
commit ce8ffabba7
5 changed files with 74 additions and 25 deletions
+15
View File
@@ -96,3 +96,18 @@ func TestTelegramProxyCandidatesDefaultLocalFallbacks(t *testing.T) {
}
}
}
func TestTelegramCommandFiltering(t *testing.T) {
if telegramIsCommandText("今天看什么") {
t.Fatal("plain chat message should not be treated as command")
}
if !telegramIsCommandText("/start user pass") {
t.Fatal("/start should be treated as command")
}
if got := telegramCommandName("/hideadult@MediaStationGoBot on"); got != "/hideadult" {
t.Fatalf("telegramCommandName = %q, want /hideadult", got)
}
if telegramSupportedCommand("/签到") {
t.Fatal("unrelated group bot command should not be handled")
}
}