-
Notifications
You must be signed in to change notification settings - Fork 1
/
main.go
37 lines (31 loc) · 792 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
package main
import (
// Standard library
"os"
// Internal packages
"github.com/deuill/informbot/joe-inform-handler"
"github.com/deuill/informbot/joe-xmpp-adapter"
// Third-party packages
"github.com/go-joe/file-memory"
"github.com/go-joe/joe"
)
func main() {
bot := joe.New(
"inform",
xmpp.Adapter(xmpp.Config{
JID: os.Getenv("INFORMBOT_JID"),
Password: os.Getenv("INFORMBOT_PASSWORD"),
NoTLS: os.Getenv("INFORMBOT_NO_TLS") == "true",
UseStartTLS: os.Getenv("INFORMBOT_USE_STARTTLS") == "true",
}),
file.Memory("store.json"),
)
in, err := inform.New(inform.Config{Bot: bot})
if err != nil {
bot.Logger.Fatal(err.Error())
}
bot.Brain.RegisterHandler(in.Handle)
if err := bot.Run(); err != nil {
bot.Logger.Fatal(err.Error())
}
}