예제 #1
0
파일: mine.go 프로젝트: ch0wdan/rowdy-bot
func process(s *session.Session, users *http.Users, i int, follows float64) {
	for i >= 0 {

		id := users.Data[i].Id
		user := http.GetUser(s, id)

		log.Println(user)

		if user.Data.Counts.Followed_by+user.Data.Counts.Follows > 0 {
			//check follower records, if following and guy in other records, don't do anythin
			person := session.Person{
				Followers: float64(user.Data.Counts.Follows),
				Following: float64(user.Data.Counts.Followed_by),
				Posts:     float64(user.Data.Counts.Media),
				Follows:   !s.CheckCache(id),
			}

			// Because unset properties won't change, this should be fine
			if int(follows) == utils.SCORN {
				person.Followed = true
				person.Follows = !person.Follows
			}

			// Add to variable and to Keys
			s.PutPerson(person, id)
		}

		// Decrement
		i--
	}

	// Catches up and thus done
	if s.FinishedCount() {
		s.SavePeople()
		s.StopProcessing()
	}
}