-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathscrumpolice.go
48 lines (38 loc) · 1.21 KB
/
scrumpolice.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
45
46
47
48
package main
import (
"flag"
"fmt"
"log"
"os"
"github.com/nlopes/slack"
"github.com/pastjean/scrumpolice/bot"
"github.com/pastjean/scrumpolice/scrum"
"github.com/sirupsen/logrus"
)
const header = " _ _\n" +
" ___ ___ _ __ _ _ _ __ ___ _ __ ___ | (_) ___ ___\n" +
"/ __|/ __| '__| | | | '_ ` _ \\| '_ \\ / _ \\| | |/ __/ _ \\\n" +
"\\__ \\ (__| | | |_| | | | | | | |_) | (_) | | | (_| __/\n" +
"|___/\\___|_| \\__,_|_| |_| |_| .__/ \\___/|_|_|\\___\\___|\n" +
" |_|"
const Version = "0.7.1"
func main() {
fmt.Println(header)
fmt.Println("Version", Version)
fmt.Println("")
slackBotToken := os.Getenv("SCRUMPOLICE_SLACK_TOKEN")
if slackBotToken == "" {
log.Fatalln("slack bot token must be set in SCRUMPOLICE_SLACK_TOKEN")
}
configFile := "config.json"
flag.StringVar(&configFile, "config", configFile, "The configuration file")
flag.Parse()
// Injection
logger := logrus.New()
configurationProvider := scrum.NewConfigWatcher(configFile)
slackAPIClient := slack.New(slackBotToken)
scrum := scrum.NewService(configurationProvider, slackAPIClient)
// Create and run bot
b := bot.New(slackAPIClient, logger, scrum)
b.Run()
}