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.3-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	0 - Exit script
 70option to select: `
 71	for {
 72		fmt.Print(options)
 73
 74		option, _ := newcommand.ReadString('\n')
 75		option = strings.TrimSpace(option)
 76
 77		switch option {
 78		case "1":
 79			fmt.Println("selected 1 - Analyze username")
 80			optionAnalyzeUserTweets(client)
 81			fmt.Println("")
 82			c.Purple("Note: the current hours displaying, are the Twitter servers hours (Coordinated Universal Time (UTC) +0000 UTC)")
 83			break
 84		case "2":
 85			fmt.Println("selected 2 - Unfollow all")
 86			optionUnfollowAll(client)
 87			break
 88		case "3":
 89			fmt.Println("selected 3 - Follow random")
 90			optionFollowRandom(client)
 91			break
 92		case "4":
 93			fmt.Println("selected 4 - Delete Tweets")
 94			optionDeleteTweets(client)
 95			break
 96		case "5":
 97			fmt.Println("selected 5 - Delete Favs (Likes)")
 98			optionDeleteFavs(client)
 99			break
100		case "6":
101			fmt.Println("selected 5 - Tweet random")
102			optionTweetRandom(client)
103			break
104		case "0":
105			fmt.Println("selected 0 - exit script")
106			os.Exit(3)
107			break
108		default:
109			fmt.Println("Invalid option")
110			break
111		}
112	}
113}