diff --git a/pattern.go b/pattern.go index 4c4e3d3..8f0b75e 100644 --- a/pattern.go +++ b/pattern.go @@ -76,25 +76,25 @@ type PatternParsed struct { Msg *message.Segment } -func (p PatternParsed) GetText() []string { +func (p PatternParsed) Text() []string { if !p.Valid { return nil } return p.Value.([]string) } -func (p PatternParsed) GetAt() string { +func (p PatternParsed) At() string { if !p.Valid { return "" } return p.Value.(string) } -func (p PatternParsed) GetImage() string { +func (p PatternParsed) Image() string { if !p.Valid { return "" } return p.Value.(string) } -func (p PatternParsed) GetReply() string { +func (p PatternParsed) Reply() string { if !p.Valid { return "" } diff --git a/pattern_test.go b/pattern_test.go index 4c5e35e..1d2137f 100644 --- a/pattern_test.go +++ b/pattern_test.go @@ -122,10 +122,10 @@ func TestPattern_Reply(t *testing.T) { } } func TestPatternParsed_Gets(t *testing.T) { - assert.Equal(t, []string{"gaga"}, PatternParsed{Valid: true, Value: []string{"gaga"}}.GetText()) - assert.Equal(t, "image", PatternParsed{Valid: true, Value: "image"}.GetImage()) - assert.Equal(t, "reply", PatternParsed{Valid: true, Value: "reply"}.GetReply()) - assert.Equal(t, "114514", PatternParsed{Valid: true, Value: "114514"}.GetAt()) + assert.Equal(t, []string{"gaga"}, PatternParsed{Valid: true, Value: []string{"gaga"}}.Text()) + assert.Equal(t, "image", PatternParsed{Valid: true, Value: "image"}.Image()) + assert.Equal(t, "reply", PatternParsed{Valid: true, Value: "reply"}.Reply()) + assert.Equal(t, "114514", PatternParsed{Valid: true, Value: "114514"}.At()) } func TestPattern_SetOptional(t *testing.T) { assert.Panics(t, func() {