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