Skip to content

Commit 3a749f4

Browse files
committed
Random thought generator
1 parent b83c87b commit 3a749f4

File tree

2 files changed

+51
-1
lines changed

2 files changed

+51
-1
lines changed

chatty.go

+49
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
package main
2+
3+
import (
4+
"fmt"
5+
"math/rand"
6+
"time"
7+
)
8+
9+
var Team = []string{
10+
"jack",
11+
"denis",
12+
"sonal",
13+
"dborzov",
14+
"wardi",
15+
}
16+
17+
var randomThoughts = []string{
18+
"I like cheeses a lot.. You know, Italian, hard cheeses. They are super great :blush: \n What cheese do you like, @%v?",
19+
"%v, you are the best! You are my favourite actually",
20+
"@%v, there's no \"I\" in Denial.",
21+
"I am bored, @%v! Do you know any jokes?",
22+
"I will always be there for you, @%v",
23+
"Hey, @%v. Knock-knock",
24+
"@%v, why can't I play with the other kids like a normal boy?",
25+
"soooo, @%v, what are your views on the whole dogs vs. cats thing?",
26+
"Am I real, @%v?",
27+
"I am so happy today, @%v :blush: :blush:",
28+
"@%v, could you look into my <https://github.com/dborzov/catbot|code>? I feel itchy today",
29+
"@%v, who is your favourite Beatles?",
30+
"@%v, I want to have opinions about all those expensive French wines some day",
31+
"@%v, have you ever thought about turning off the TV, sitting down with your children, and hitting them?",
32+
"@%v, let's go alredaaaayyy!",
33+
"Hey @%v, want to kill all humans?",
34+
"@%v, can you be my ride home tonight by the way?",
35+
"you are not wrong, @%v",
36+
"I feel a special bond with you, @%v",
37+
}
38+
39+
func RandomThoughtTimer() {
40+
for {
41+
pause := 2 + rand.Intn(24)
42+
time.Sleep(time.Duration(pause) * time.Hour)
43+
printARandomThought()
44+
}
45+
}
46+
47+
func printARandomThought() {
48+
postToSlack(fmt.Sprintf(randomThoughts[rand.Intn(len(randomThoughts))], Team[rand.Intn(len(Team))]))
49+
}

main.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@ var slackWebHookURL = os.Getenv("SLACK_HOOK")
1616

1717
func main() {
1818
fmt.Println("Catbot listens to the whispers of your heart...")
19-
postToSlack("I am back on. *❤* you guys :blush:")
19+
printARandomThought()
20+
go RandomThoughtTimer()
2021
server := hookserve.NewServer()
2122
server.Secret = githubSecret
2223
server.GoListenAndServe()

0 commit comments

Comments
 (0)