Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

start of a smack command, but only works after the command being issued

a second time.
  • Loading branch information...
commit c14be0599459e6fc88ec80936050bab5d3063a69 1 parent f0e7c33
Rick E authored
Showing with 12 additions and 4 deletions.
  1. +12 −4 irc.go
16 irc.go
View
@@ -92,16 +92,24 @@ func main() {
}
ping,err := regexp.MatchString("PING", msg)
if ping {
- con.socket.Write(strings.Bytes("PONG :irc.eighthbit.net"))
+ con.socket.Write(strings.Bytes("PONG :" + con.server))
println("*** POKE *** I have just ***PONG***'d the server!")
} else { // Not a ping, so show the message. We also handle commands here.
args := strings.Split(msg, " :", 2)
// args = strings.Split(args[0], " ", 0)
if len(args) > 1 {
- printmsg = fmt.Sprintf("%s (%s@%s) said: %s", nick, user, host, args[1])
- println(printmsg)
+ printmsg = fmt.Sprintf("%s (%s@%s) said: %s", nick, user, host, args[1])
+ println(printmsg)
+ smack, _ := regexp.MatchString("!smack", printmsg)
+ if smack {
+ println("SMACK ALERT!")
+ re, _ := regexp.Compile("!smack (.+)")
+ matches := re.MatchStrings(printmsg)
+ fmt.Printf("%#v\n", matches);
+ println("GOOD OL' '" + matches[1] + "'")
+ con.socket.Write(strings.Bytes("PRIVMSG #bots :\001ACTION smacks " + matches[1] + "\001\r\n"))
+ }
}
}
-
}
}
Please sign in to comment.
Something went wrong with that request. Please try again.