echo-botnet/main.go
main.goRaw
1package main
2
3import (
4 "fmt"
5 "log"
6 "strconv"
7 "time"
8
9 "github.com/fatih/color"
10)
11
12const version = "0.1-dev"
13
14func main() {
15 savelog()
16 color.Blue("echo-botnet")
17 fmt.Println("---------------")
18 color.Cyan("echo-botnet initialized")
19 color.Green("https://github.com/arnaucode/echo-botnet")
20 log.Println("version " + version)
21
22 readKeywordsConfig()
23 color.Cyan("keywords configured: ")
24 fmt.Println(keywords)
25 readRepliesConfig()
26 color.Cyan("replies configured: ")
27 fmt.Println(replies)
28
29 fmt.Println("Reading botsConfig.json file")
30 readConfigTokensAndConnect()
31 color.Cyan("[list of configured bots]:")
32 for _, bot := range botnet {
33 color.Cyan(bot.Title)
34 }
35 var i int
36 for {
37 color.Red(strconv.Itoa(i))
38 sinceTweeted := time.Unix(botnet[i].SinceTweeted, 0)
39 elapsed := time.Since(sinceTweeted)
40 fmt.Println(elapsed)
41 if elapsed.Seconds() > 60 {
42 log.Println("starting to use bot: " + botnet[i].Title)
43 startStreaming(botnet[i])
44 } else {
45 log.Println("bot: " + botnet[i].Title + " not used due bot is in waiting time")
46 }
47 i++
48 if i > len(botnet)-1 {
49 i = 0
50 }
51 }
52}