arnaucube
arnaucube/argosPublic Self-hosted repository
argos/main.go
main.goRaw
 1package main
 2
 3import (
 4	"bufio"
 5	"fmt"
 6	"os"
 7	"strings"
 8)
 9
10const version = "0.1-dev"
11const minNumWords = 10
12const minNumHashtag = 2
13const minNumUserInteractions = 1
14const iterationsCount = 3
15
16func main() {
17	c.Yellow("Argos Panoptes")
18	fmt.Println("---------------")
19	c.Cyan("argos initialized")
20	c.Purple("https://github.com/arnaucode/argos")
21	c.Purple("http://arnaucode/argos")
22	fmt.Println("version " + version)
23	fmt.Println("Reading twitterConfig.json file")
24	client := readConfigTokensAndConnect()
25
26	fmt.Println("---------------")
27	fmt.Println("Getting user data...")
28	user := getUserData(client)
29	printUserData(user)
30	if user.ScreenName == "" {
31		c.Red("Can not connect to Twitter API, maybe the file twitterConfig.json is wrong")
32		os.Exit(3)
33	}
34	fmt.Println("")
35
36	newcommand := bufio.NewReader(os.Stdin)
37	fmt.Print("Please select command number")
38	options := `
39	1 - Analyze username
40	2 - Unfollow all
41	3 - Follow random
42	4 - Delete Tweets
43	5 - Delete Favs (Likes)
44	6 - Tweet Random
45	0 - Exit script
46option to select: `
47	for {
48		fmt.Print(options)
49
50		option, _ := newcommand.ReadString('\n')
51		option = strings.TrimSpace(option)
52
53		switch option {
54		case "1":
55			fmt.Println("selected 1 - Analyze username")
56			optionAnalyzeUserTweets(client)
57			fmt.Println("")
58			c.Purple("Note: the current hours displaying, are the Twitter servers hours (Coordinated Universal Time (UTC) +0000 UTC)")
59			break
60		case "2":
61			fmt.Println("selected 2 - Unfollow all")
62			optionUnfollowAll(client)
63			break
64		case "3":
65			fmt.Println("selected 3 - Follow random")
66			optionFollowRandom(client)
67			break
68		case "4":
69			fmt.Println("selected 4 - Delete Tweets")
70			optionDeleteTweets(client)
71			break
72		case "5":
73			fmt.Println("selected 5 - Delete Favs (Likes)")
74			optionDeleteFavs(client)
75			break
76		case "6":
77			fmt.Println("selected 5 - Tweet random")
78			optionTweetRandom(client)
79			break
80		case "0":
81			fmt.Println("selected 0 - exit script")
82			os.Exit(3)
83			break
84		default:
85			fmt.Println("Invalid option")
86			break
87		}
88	}
89}