Created
October 29, 2013 20:42
-
-
Save rossdylan/7222245 to your computer and use it in GitHub Desktop.
Annoy your friends!
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package main | |
| import "github.com/thoj/go-ircevent" | |
| import "os" | |
| import "os/exec" | |
| import "strings" | |
| import "fmt" | |
| func CowSay(msg string) { | |
| new_msg := strings.Replace(msg, "#", "hashtag ", -1) | |
| cmd_msg := "(SayText \"" + new_msg + "\")" | |
| fi, err := os.Create("/tmp/cowsay") | |
| if err != nil { | |
| panic(err) | |
| } | |
| fi.WriteString(cmd_msg) | |
| fi.Close() | |
| cmd := exec.Command("/usr/bin/festival", "/tmp/cowsay") | |
| fmt.Println("Speaking :" + cmd_msg) | |
| run_err := cmd.Run() | |
| if run_err != nil { | |
| fmt.Println("Shits fucked yo") | |
| } | |
| } | |
| func MSGEvent(event *irc.Event) { | |
| if strings.Contains(event.Message, "#cowsay") { | |
| go CowSay(event.Message) | |
| } | |
| } | |
| func main() { | |
| ircobj := irc.IRC("cowbot", "dicks") | |
| ircobj.Connect("skynet.csh.rit.edu:6667") | |
| ircobj.Join("#usercenter") | |
| ircobj.AddCallback("PRIVMSG", MSGEvent) | |
| ircobj.Loop() | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment