arnaucube
arnaucube/flock-botnetPublic Self-hosted repository
flock-botnet/main.go
main.goRaw
 1package main
 2
 3import (
 4	"bufio"
 5	"fmt"
 6	"os"
 7	"strconv"
 8	"strings"
 9)
10
11const version = "0.1-dev"
12
13func main() {
14	c.Yellow("twFlock")
15	fmt.Println("---------------")
16	c.Cyan("twFlock initialized")
17	c.Purple("https://github.com/arnaucode/twFlock")
18	fmt.Println("version " + version)
19	fmt.Println("Reading flockConfig.json file")
20	//flock := readConfigTokensAndConnect()
21	var flock Flock
22	fmt.Println("---------------")
23	newcommand := bufio.NewReader(os.Stdin)
24	fmt.Print("Please select command number")
25	options := `
26	1 - Tweet from flock of bots
27	2 - Markov
28	0 - Exit script
29option to select: `
30	for {
31		fmt.Print(options)
32
33		option, _ := newcommand.ReadString('\n')
34		option = strings.TrimSpace(option)
35
36		switch option {
37		case "1":
38			fmt.Println("selected 1 - Tweet from flock of bots")
39			optionTweetFromFlock(flock)
40			break
41		case "2":
42			fmt.Println("selected 2 - Markov")
43
44			fmt.Print("entry the first word: ")
45			newcommand := bufio.NewReader(os.Stdin)
46			firstWord, _ := newcommand.ReadString('\n')
47			firstWord = strings.TrimSpace(firstWord)
48			fmt.Print("first word: ")
49			c.Purple(firstWord)
50
51			c.Red("how many words you want on the text?")
52			newcommand = bufio.NewReader(os.Stdin)
53			answer, _ := newcommand.ReadString('\n')
54			answer = strings.TrimSpace(answer)
55			fmt.Print("Number of words on text to generate: ")
56			c.Purple(answer)
57			count, err := strconv.Atoi(answer)
58			if err != nil {
59				fmt.Println("incorrect entry, need a positive number")
60			}
61
62			states := markov.train("the", "text.txt")
63			generatedText := markov.generateText(states, firstWord, count)
64			c.Green(generatedText)
65			break
66		case "0":
67			fmt.Println("selected 0 - exit script")
68			os.Exit(3)
69			break
70		default:
71			fmt.Println("Invalid option")
72			break
73		}
74	}
75}