-
Notifications
You must be signed in to change notification settings - Fork 42
/
commands.go
65 lines (51 loc) · 1.8 KB
/
commands.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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
package command
import (
"github.com/innogames/slack-bot/bot"
"github.com/innogames/slack-bot/bot/config"
"github.com/innogames/slack-bot/client"
"github.com/innogames/slack-bot/command/admin"
"github.com/innogames/slack-bot/command/cron"
"github.com/innogames/slack-bot/command/custom"
"github.com/innogames/slack-bot/command/games"
"github.com/innogames/slack-bot/command/jenkins"
"github.com/innogames/slack-bot/command/jira"
"github.com/innogames/slack-bot/command/pullrequest"
"github.com/innogames/slack-bot/command/queue"
"github.com/innogames/slack-bot/command/variables"
"github.com/innogames/slack-bot/command/weather"
)
// GetCommands returns the list of default command which are available
func GetCommands(slackClient client.SlackClient, cfg config.Config) *bot.Commands {
base := bot.BaseCommand{SlackClient: slackClient}
commands := &bot.Commands{}
commands.AddCommand(
// needs to be the first commands to store all executed commands
NewRetryCommand(base, &cfg),
NewCommands(base, cfg.Commands),
NewReplyCommand(base),
NewAddLinkCommand(base),
NewAddButtonCommand(base, cfg.Server),
NewReactionCommand(base),
NewSendMessageCommand(base),
NewDelayCommand(base),
NewRandomCommand(base),
NewHelpCommand(base, commands),
admin.NewBotLogCommand(base, cfg),
admin.NewStatsCommand(base, cfg),
weather.NewWeatherCommand(base, cfg.OpenWeather),
cron.NewCronCommand(base, cfg.Crons),
queue.NewQueueCommand(base),
queue.NewListCommand(base),
custom.GetCommand(base),
variables.GetCommand(base),
)
// games
commands.Merge(games.GetCommands(base))
// jira
commands.Merge(jira.GetCommands(&cfg.Jira, slackClient))
// jenkins
commands.Merge(jenkins.GetCommands(cfg.Jenkins, base))
// pull-request
commands.Merge(pullrequest.GetCommands(base, &cfg))
return commands
}