Add example
This commit is contained in:
parent
491578616f
commit
e7aa1b5e94
27
examples/simple/simple.go
Normal file
27
examples/simple/simple.go
Normal file
@ -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()
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user