You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

68 lines
1.7 KiB

  1. package main
  2. import (
  3. "bufio"
  4. "fmt"
  5. "os"
  6. "strconv"
  7. "strings"
  8. "github.com/dghubble/go-twitter/twitter"
  9. )
  10. /*func getUserByScreenName(ScreenName string) *twitter.User{
  11. }*/
  12. func getUserFollower(client *twitter.Client) string {
  13. ScreenName := "username"
  14. return ScreenName
  15. }
  16. func followUser(client *twitter.Client, ScreenName string) {
  17. }
  18. func followRandom(client *twitter.Client, nFollow int, ScreenName string) {
  19. fmt.Println("Starting to follow " + strconv.Itoa(nFollow) + " users")
  20. for i := 0; i < nFollow; i++ {
  21. ScreenName = getUserFollower(client)
  22. followUser(client, ScreenName)
  23. }
  24. }
  25. func optionFollowRandom(client *twitter.Client) {
  26. c.Red("how many accounts to follow?")
  27. newcommand := bufio.NewReader(os.Stdin)
  28. answer, _ := newcommand.ReadString('\n')
  29. answer = strings.TrimSpace(answer)
  30. fmt.Print("Number of users to follow: ")
  31. c.Purple(answer)
  32. nFollow, err := strconv.Atoi(answer)
  33. if err != nil {
  34. fmt.Println("incorrect entry, need a positive number")
  35. }
  36. fmt.Print("entry @username of a user, to get a 1st user to follow, that will be a user that the 1st user is following, and the 2nd user will be a user that the 3rd user is following): @")
  37. newcommand = bufio.NewReader(os.Stdin)
  38. firstScreenName, _ := newcommand.ReadString('\n')
  39. firstScreenName = strings.TrimSpace(firstScreenName)
  40. fmt.Print("first user to follow: @")
  41. c.Purple(answer)
  42. c.Red("Are you sure? [y/n]")
  43. newcommand = bufio.NewReader(os.Stdin)
  44. answer, _ = newcommand.ReadString('\n')
  45. answer = strings.TrimSpace(answer)
  46. switch answer {
  47. case "y":
  48. fmt.Println("ok, you are sure")
  49. followRandom(client, nFollow, firstScreenName)
  50. break
  51. default:
  52. fmt.Println("Operation cancelled")
  53. break
  54. }
  55. }