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