Skip to content

Commit 617122a

Browse files
committed
Merge pull request NARKOZ#79 from xer0k00l/smacked_my_bitch_added_to_go
golang smacked my bitch up
2 parents 3288f96 + 7c5686a commit 617122a

File tree

1 file changed

+39
-0
lines changed

1 file changed

+39
-0
lines changed

go/smack_my_bitch_up.go

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
package main
2+
3+
import(
4+
"os/exec"
5+
"fmt"
6+
"strings"
7+
"os"
8+
"math/rand"
9+
"time"
10+
)
11+
12+
func main(){
13+
output1,err := exec.Command("who").Output()
14+
output2 := os.Getenv("USER")
15+
users := string(output1[:])
16+
current_user := string(output2[:])
17+
if(!strings.Contains(users,current_user)){
18+
return
19+
}
20+
21+
22+
reasons := []string {"Working hard","Gotta ship this feature","Someone fucked the system again"}
23+
24+
rand.Seed(time.Now().UTC().UnixNano())
25+
message := "Late at work. " + reasons[rand.Intn(len(reasons))]
26+
27+
TWILIO_ACCOUNT_SID := string(os.Getenv("TWILIO_ACCOUNT_SID"))
28+
TWILIO_AUTH_TOKEN := string(os.Getenv("TWILIO_AUTH_TOKEN"))
29+
MY_NUMBER := string(os.Getenv("MY_NUMBER"))
30+
HER_NUMBER := string(os.Getenv("HER_NUMBER"))
31+
32+
response,err := exec.Command("curl","-fSs","-u",TWILIO_ACCOUNT_SID + ":" + TWILIO_AUTH_TOKEN, "-d", "From=" + MY_NUMBER, "-d", "To=" + HER_NUMBER, "-d" , "Body=" + message, "https://api.twilio.com/2010-04-01/Accounts/" + TWILIO_ACCOUNT_SID + "/Messages").Output()
33+
if(err != nil){
34+
fmt.Printf("Failed to send SMS: ",err.mess)
35+
return
36+
}
37+
38+
fmt.Printf("Message Sent Successfully with response: %s ",response)
39+
}

0 commit comments

Comments
 (0)