arnaucube
arnaucube/flock-botnetPublic Self-hosted repository
flock-botnet/flock.go
flock.goRaw
 1package main
 2
 3import (
 4	"fmt"
 5	"strconv"
 6
 7	"github.com/dghubble/go-twitter/twitter"
 8)
 9
10func replyTweet(client *twitter.Client, text string, inReplyToStatusID int64) {
11	tweet, httpResp, err := client.Statuses.Update(text, &twitter.StatusUpdateParams{
12		InReplyToStatusID: inReplyToStatusID,
13	})
14	if err != nil {
15		fmt.Println(err)
16	}
17	if httpResp.Status != "200 OK" {
18		c.Red("error: " + httpResp.Status)
19		c.Purple("maybe twitter has blocked the account, CTRL+C, wait 15 minutes and try again")
20	}
21	fmt.Print("tweet posted: ")
22	c.Green(tweet.Text)
23}
24
25func postTweet(client *twitter.Client, text string) {
26	tweet, httpResp, err := client.Statuses.Update(text, nil)
27	if err != nil {
28		fmt.Println(err)
29	}
30	if httpResp.Status != "200 OK" {
31		c.Red("error: " + httpResp.Status)
32		c.Purple("maybe twitter has blocked the account, CTRL+C, wait 15 minutes and try again")
33	}
34	fmt.Print("tweet posted: ")
35	c.Green(tweet.Text)
36}
37func tweetFromFlock(flock Flock, text string) {
38	fmt.Println("Starting to publish tweet: " + text)
39	fmt.Println(strconv.Itoa(len(flock.Clients)))
40	for i := 0; i < len(flock.Clients); i++ {
41		fmt.Print("tweeting from: ")
42		c.Cyan("@" + flock.ScreenNames[i])
43		postTweet(flock.Clients[i], text)
44		//waitTime(1)
45	}
46
47}