diff --git a/types.go b/types.go index b8c0e7d..5bf5437 100644 --- a/types.go +++ b/types.go @@ -2,6 +2,7 @@ package main import ( "encoding/json" + "fmt" "html" "strings" "time" @@ -50,6 +51,10 @@ type Status struct { Quoted_status *Status Retweeted_status *Status Extended_entities Entities + //only available in premium API Quote_count int64 + //only available in premium API Reply_count int64 + Retweet_count int64 + Favorite_count int64 } func (t Status) Error() string { @@ -85,15 +90,19 @@ func (t Status) InReplyTo() string { } } +func (t Status) Text() string { + return html.UnescapeString(t.Full_text) +} + func (t Status) String() string { if t.Retweeted_status != nil { return t.User.Screen_name + " retweeted " + t.Retweeted_status.String() } - s := t.User.Screen_name + " " + "(" + t.Id_str + ")" + s := t.User.Screen_name + " " + "(" + t.Id_str + ")" + fmt.Sprintf(" (rt:%d,fav:%d)", t.Retweet_count, t.Favorite_count) if replyTo := t.InReplyTo(); replyTo != "" { s += " in reply to " + replyTo } - s += ":\n" + html.UnescapeString(t.Full_text) + s += ":\n" + t.Text() allMedia := t.Extended_entities.Media if len(allMedia) > 0 { s += "\n\nMedia:"