-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
44 lines (36 loc) · 866 Bytes
/
main.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
package main
import (
"crypto/tls"
"log"
"os"
"github.com/eholzbach/phosewp/config"
"github.com/eholzbach/phosewp/events"
"github.com/eholzbach/phosewp/plugins"
irc "github.com/thoj/go-ircevent"
)
func main() {
// read configuration
log.Print("reading configuration...")
conf, err := config.Config()
if err != nil {
log.Println(err)
os.Exit(1)
}
// set up connection parameters
conn := irc.IRC(conf.Handle, conf.Handle)
conn.UseTLS = conf.TLS
conn.TLSConfig = &tls.Config{InsecureSkipVerify: true}
conn.UseSASL = conf.SASL
conn.SASLLogin = conf.Handle
conn.SASLPassword = conf.Password
log.Println("connecting bot...")
// connnect to server
if err := conn.Connect(conf.Network); err != nil {
log.Println(err)
os.Exit(1)
}
// start up event handlers
go events.Global(conn, conf)
go plugins.Plugins(conn, conf)
conn.Loop()
}