argos/main.go
main.goRaw
1package main
2
3import (
4 "bufio"
5 "fmt"
6 "os"
7 "strings"
8)
9
10const version = "0.5-beta"
11const minNumWords = 10
12const minNumHashtag = 2
13const minNumUserInteractions = 2
14const iterationsCount = 3
15
16func main() {
17 eye := `
18 ___________
19 .-=d88888888888b=-.
20 .:d8888pr |\|/-\| rq8888b.
21 ,:d8888P^//\-\/_\ /_\/^q888/b.
22 ,;d88888/~-/ .-~ _~-. |/-q88888b,
23 //8888887-\ _/ (#) \\-\/Y88888b\
24 \8888888|// T Y _/|888888 o
25 \q88888|- \l !\_/|88888p/
26 q8888l\-//\ / /\|!8888P
27 q888\/-| -,___.-^\/-\/888P
28 =88\./-/|/ |-/!\/-!/88=
29 ^^ ------------- ^
30 _____ _____ ____ _____
31 /\ | __ \ / ____|/ __ \ / ____|
32 / \ | |__) | | __| | | | (___
33 / /\ \ | _ /| | |_ | | | |\___ \
34 / ____ \| | \ \| |__| | |__| |____) |
35 /_/ \_\_| \_\\_____|\____/|_____/
36
37 Open source twitter entropic toolkit
38 `
39 c.Cyan(eye)
40 c.DarkGray("--Be half bot and half human, a new generation of cyborgs--")
41 fmt.Println("---------------")
42 fmt.Print("source code: ")
43 c.Purple("https://github.com/arnaucode/argos")
44 fmt.Print("project page: ")
45 c.Purple("http://arnaucode/argos")
46 fmt.Print("version ")
47 c.Purple(version)
48 fmt.Println("---------------")
49 client := readConfigTokensAndConnect()
50
51 fmt.Println("Getting user data...")
52 user := getUserData(client)
53 printUserData(user)
54 if user.ScreenName == "" {
55 c.Red("Can not connect to Twitter API, maybe the file twitterConfig.json is wrong")
56 os.Exit(3)
57 }
58 fmt.Println("")
59
60 newcommand := bufio.NewReader(os.Stdin)
61 fmt.Print("Please select command number")
62 options := `
63 1 - Analyze username
64 2 - Unfollow all
65 3 - Follow random
66 4 - Delete Tweets
67 5 - Delete Favs (Likes)
68 6 - Tweet Random
69 7 - Analyze tweet
70 8 - Analyze User Followers
71 0 - Exit script
72option to select: `
73 for {
74 fmt.Print(options)
75
76 option, _ := newcommand.ReadString('\n')
77 option = strings.TrimSpace(option)
78
79 switch option {
80 case "1":
81 fmt.Println("selected 1 - Analyze username")
82 username := askForUsername()
83 optionAnalyzeUserTweets(client, username)
84 fmt.Println("")
85 c.Purple("Note: the current hours displaying, are the Twitter servers hours (Coordinated Universal Time (UTC) +0000 UTC)")
86 break
87 case "2":
88 fmt.Println("selected 2 - Unfollow all")
89 optionUnfollowAll(client)
90 break
91 case "3":
92 fmt.Println("selected 3 - Follow random")
93 optionFollowRandom(client)
94 break
95 case "4":
96 fmt.Println("selected 4 - Delete Tweets")
97 optionDeleteTweets(client)
98 break
99 case "5":
100 fmt.Println("selected 5 - Delete Favs (Likes)")
101 optionDeleteFavs(client)
102 break
103 case "6":
104 fmt.Println("selected 6 - Tweet random")
105 optionTweetRandom(client)
106 break
107 case "7":
108 fmt.Println("selected 7 - Analyze Tweet")
109 optionAnalyzeTweet(client)
110 break
111 case "8":
112 fmt.Println("selected 8 - Analyze User Followers")
113 username := askForUsername()
114 optionAnalyzeUserFollowers(client, username)
115 break
116 case "0":
117 fmt.Println("selected 0 - exit script")
118 os.Exit(3)
119 break
120 default:
121 fmt.Println("Invalid option")
122 break
123 }
124 }
125}