From e7aa1b5e946bc998a5275d856394831e29396091 Mon Sep 17 00:00:00 2001 From: Thomas Jager Date: Sat, 5 Nov 2016 19:10:18 +0100 Subject: [PATCH] Add example --- examples/simple/simple.go | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 examples/simple/simple.go diff --git a/examples/simple/simple.go b/examples/simple/simple.go new file mode 100644 index 0000000..b678602 --- /dev/null +++ b/examples/simple/simple.go @@ -0,0 +1,27 @@ +package main + +import ( + "github.com/thoja/go-ircevent" + "crypto/tls" + "fmt" +) + +const channel = "#go-eventirc-test"; +const serverssl = "irc.freenode.net:7000" + +func main() { + ircnick1 := "blatiblat" + irccon := irc.IRC(ircnick1, "IRCTestSSL") + irccon.VerboseCallbackHandler = true + irccon.Debug = true + irccon.UseTLS = true + irccon.TLSConfig = &tls.Config{InsecureSkipVerify: true} + irccon.AddCallback("001", func(e *irc.Event) { irccon.Join(channel) }) + irccon.AddCallback("366", func(e *irc.Event) { }) + err := irccon.Connect(serverssl) + if err != nil { + fmt.Printf("Err %s", err ) + return + } + irccon.Loop() +}