diff --git a/main.go b/main.go index c13d189..fe8a891 100644 --- a/main.go +++ b/main.go @@ -9,12 +9,13 @@ import ( "strings" ) +var nick = "pathbbot" + func sendData(conn net.Conn, message string) { - log.Print(message + "\n") fmt.Fprintf(conn, "%s\n", message) } func logon(conn net.Conn) { - sendData(conn, "NICK pathbbot") + sendData(conn, "NICK "+nick) sendData(conn, "User inhabitant 8 * : pathbwalker") } @@ -28,12 +29,13 @@ func join(conn net.Conn) { } func main() { - conn, err := net.Dial("tcp", "pathb.net:6667") + conn, err := net.Dial("tcp", "irc.anarchyplanet.org:6667") if err != nil { log.Print(err) } reader := bufio.NewReader(conn) + logon(conn) for { ln, err := reader.ReadString('\n') ln = strings.Trim(ln, "\n") @@ -46,12 +48,12 @@ func main() { case err != nil: log.Println("error.\n") return - case strings.Contains(ln, "Looking up your hostname"): - logon(conn) case strings.Contains(ln, "PING"): sendPong(conn, ln) - case strings.Contains(ln, "End of /MOTD command."): + case strings.Contains(ln, "001 "+nick+" :Welcome"): join(conn) + case strings.Contains(ln, "@arise"): + sendData(conn, "PRIVMSG #pathb :What the fuck did you just fucking say about me, you little bitch? I'll have you know I graduated top of my class in the Navy Seals, and I've been involved in numerous secret raids on Al-Quaeda, and I have over 300 confirmed kills. I am trained in gorilla warfare and I'm the top sniper in the entire US armed forces. You are nothing to me but just another target. I will wipe you the fuck out with precision the likes of which has never been seen before on this Earth, mark my fucking words. ") } }