make nick a variable; add @arise command

This commit is contained in:
notnull 2021-07-14 12:30:24 -04:00
parent 1f567be857
commit c13a58437b

14
main.go
View File

@ -9,12 +9,13 @@ import (
"strings" "strings"
) )
var nick = "pathbbot"
func sendData(conn net.Conn, message string) { func sendData(conn net.Conn, message string) {
log.Print(message + "\n")
fmt.Fprintf(conn, "%s\n", message) fmt.Fprintf(conn, "%s\n", message)
} }
func logon(conn net.Conn) { func logon(conn net.Conn) {
sendData(conn, "NICK pathbbot") sendData(conn, "NICK "+nick)
sendData(conn, "User inhabitant 8 * : pathbwalker") sendData(conn, "User inhabitant 8 * : pathbwalker")
} }
@ -28,12 +29,13 @@ func join(conn net.Conn) {
} }
func main() { func main() {
conn, err := net.Dial("tcp", "pathb.net:6667") conn, err := net.Dial("tcp", "irc.anarchyplanet.org:6667")
if err != nil { if err != nil {
log.Print(err) log.Print(err)
} }
reader := bufio.NewReader(conn) reader := bufio.NewReader(conn)
logon(conn)
for { for {
ln, err := reader.ReadString('\n') ln, err := reader.ReadString('\n')
ln = strings.Trim(ln, "\n") ln = strings.Trim(ln, "\n")
@ -46,12 +48,12 @@ func main() {
case err != nil: case err != nil:
log.Println("error.\n") log.Println("error.\n")
return return
case strings.Contains(ln, "Looking up your hostname"):
logon(conn)
case strings.Contains(ln, "PING"): case strings.Contains(ln, "PING"):
sendPong(conn, ln) sendPong(conn, ln)
case strings.Contains(ln, "End of /MOTD command."): case strings.Contains(ln, "001 "+nick+" :Welcome"):
join(conn) 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. ")
} }
} }