diff --git a/app/events/admin.go b/app/events/admin.go index 98b76990..e379cea3 100644 --- a/app/events/admin.go +++ b/app/events/admin.go @@ -487,7 +487,7 @@ func (a *admin) getCleanMessage(msg string) (string, error) { spamInfoLine := len(msgLines) for i, line := range msgLines { - if strings.HasPrefix(line, "spam detection results") { + if strings.HasPrefix(line, "spam detection results") || strings.HasPrefix(line, "**spam detection results**") { spamInfoLine = i - 1 break } diff --git a/app/events/admin_test.go b/app/events/admin_test.go index 510002e5..cdc852d0 100644 --- a/app/events/admin_test.go +++ b/app/events/admin_test.go @@ -96,6 +96,26 @@ func TestAdmin_getCleanMessage(t *testing.T) { } } +func TestAdmin_getCleanMessage2(t *testing.T) { + msg := `permanently banned {157419590 new_Nikita Νικήτας} + +и да, этим надо заниматься каждый день по несколько часов. За месяц увидишь ощутимый результат + +**spam detection results** +- stopword: ham, not found +- emoji: ham, 0/2 +- similarity: ham, 0.15/0.50 +- classifier: spam, probability of spam: 71.70% +- cas: ham, record not found + +_unbanned by umputun in 1m5s_` + + a := &admin{} + result, err := a.getCleanMessage(msg) + assert.NoError(t, err) + assert.Equal(t, "и да, этим надо заниматься каждый день по несколько часов. За месяц увидишь ощутимый результат", result) +} + func TestAdmin_parseCallbackData(t *testing.T) { var tests = []struct { name string