Permalink
Browse files

Add ping command

  • Loading branch information...
k4k committed Dec 20, 2017
1 parent 5feb6c3 commit aaed2605b2d3a8f75c16324601054ded8b268eb8
Showing with 9 additions and 5 deletions.
  1. +9 −5 main.go
14 main.go
@@ -47,11 +47,15 @@ func ircConnect(srv string, port int, ch string) {
irccon.AddCallback("001", func(e *irc.Event) { irccon.Join(channel) })
irccon.AddCallback("PRIVMSG", func(e *irc.Event) {
URL, urlstring := isURL(e.Message())
if URL {
title := getTitle(urlstring)
shortURL := shortenURL(urlstring)
irccon.Privmsg(channel, fmt.Sprintf("%s -- %s", shortURL, title))
if e.Message() == "!ping" {
irccon.Privmsg(channel, fmt.Sprintf("pong"))
} else {
URL, urlstring := isURL(e.Message())
if URL {
title := getTitle(urlstring)
shortURL := shortenURL(urlstring)
irccon.Privmsg(channel, fmt.Sprintf("%s -- %s", shortURL, title))
}
}
})

0 comments on commit aaed260

Please sign in to comment.