From 1dd7b1ba6fbb1a9160524eeffc9e16936c3c1ce9 Mon Sep 17 00:00:00 2001 From: Ted Wood Date: Thu, 14 Sep 2017 15:49:07 -0400 Subject: [PATCH] first connect attempts --- main.go | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/main.go b/main.go index 46cda19..d25b7ac 100644 --- a/main.go +++ b/main.go @@ -1,12 +1,26 @@ package main import ( + "fmt" "io" "net/http" + "time" + "github.com/clarkf/libirc" "golang.org/x/net/html" ) +func ircConnect(svr string, cnl string) { + c := libirc.NewClient("webby", "webby-bot", "Webby Bot") + + connErr := c.ConnectAndListen(fmt.Sprintf("%s:6667", svr)) + if connErr != nil { + panic(connErr) + } + + c.Join(cnl) +} + func isTitleElement(n *html.Node) bool { return n.Type == html.ElementNode && n.Data == "title" } @@ -35,6 +49,10 @@ func GetHtmlTitle(r io.Reader) (string, bool) { } func main() { + + ircConnect("irc.freenode.net", "#foaas") + time.Sleep(time.Duration(5) * time.Second) + url := "http://google.com" resp, getErr := http.Get(url) if getErr != nil {