-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtask-rules.go
48 lines (41 loc) · 1.31 KB
/
task-rules.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 (
"strings"
"github.com/nlopes/slack"
)
var commit = []string{
"```",
"<type>(<scope>): <subject>",
"or:",
"<type>: <subject>",
"",
"Type is mandatory and the scope is optional.",
"",
"• feat: A new feature",
"• fix: A bug fix",
"• docs: Documentation only changes",
"• style: Changes that do not affect the meaning of the code (white-space, formatting, missing semi-colons, etc)",
"• refactor: A code change that neither fixes a bug nor adds a feature",
"• perf: A code change that improves performance",
"• test: Adding missing tests",
"• chore: Changes to the build process or auxiliary tools and libraries such as documentation generation",
"```",
"",
"[See full convention here](https://github.com/conventional-changelog/conventional-changelog-angular/blob/master/convention.md)",
}
func taskRule(rtm *slack.RTM, ev *slack.MessageEvent, params []string) {
if len(params) == 0 {
return
}
if params[0] == "-help" {
text := "`rules commit`, gives a reminder how to name your commit"
rtm.SendMessage(rtm.NewOutgoingMessage(text, ev.Channel))
return
}
switch params[0] {
case "commit":
rtm.SendMessage(rtm.NewOutgoingMessage(strings.Join(commit, "\n"), ev.Channel))
default:
rtm.SendMessage(rtm.NewOutgoingMessage("sorry, i don't understand.", ev.Channel))
}
}