// Get mentions func getMentions(mentionsCount string, api *anaconda.TwitterApi) []anaconda.Tweet { params := url.Values{} params.Set("count", mentionsCount) // TODO: Track tweet ID we checked up to last time, and check from there onwards mentions, err := api.GetMentionsTimeline(params) if err != nil { log.Fatalf("Failed to get mentions: %s", err) } return (mentions) }
func GetMentions(api *anaconda.TwitterApi, db *sql.DB) (retrieved_tweets []anaconda.Tweet) { var lastMention int64 v := url.Values{} v.Add("count", "200") v.Add("include_rts", "1") err := db.QueryRow("SELECT ID FROM tweet ORDER BY ID DESC LIMIT 1;").Scan(&lastMention) if err == nil { lastMentionStr := strconv.FormatInt(lastMention, 10) v.Add("since_id", lastMentionStr) } retrieved_tweets, err = api.GetMentionsTimeline(v) iffy.PanicIf(err) return }