-
Notifications
You must be signed in to change notification settings - Fork 4
/
robot.go
62 lines (49 loc) · 1.64 KB
/
robot.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
package main
import (
"errors"
"github.com/opensourceways/community-robot-lib/config"
"github.com/opensourceways/community-robot-lib/robot-gitee-framework"
sdk "github.com/opensourceways/go-gitee/gitee"
"github.com/sirupsen/logrus"
)
// TODO: set botName
const botName = ""
type iClient interface {
}
func newRobot(cli iClient) *robot {
return &robot{cli: cli}
}
type robot struct {
cli iClient
}
func (bot *robot) NewConfig() config.Config {
return &configuration{}
}
func (bot *robot) getConfig(cfg config.Config) (*configuration, error) {
if c, ok := cfg.(*configuration); ok {
return c, nil
}
return nil, errors.New("can't convert to configuration")
}
func (bot *robot) RegisterEventHandler(f framework.HandlerRegitster) {
f.RegisterIssueHandler(bot.handleIssueEvent)
f.RegisterPullRequestHandler(bot.handlePREvent)
f.RegisterNoteEventHandler(bot.handleNoteEvent)
f.RegisterPushEventHandler(bot.handlePushEvent)
}
func (bot *robot) handlePREvent(e *sdk.PullRequestEvent, c config.Config, log *logrus.Entry) error {
// TODO: if it doesn't needd to hand PR event, delete this function.
return nil
}
func (bot *robot) handleIssueEvent(e *sdk.IssueEvent, c config.Config, log *logrus.Entry) error {
// TODO: if it doesn't needd to hand Issue event, delete this function.
return nil
}
func (bot *robot) handlePushEvent(e *sdk.PushEvent, c config.Config, log *logrus.Entry) error {
// TODO: if it doesn't needd to hand Push event, delete this function.
return nil
}
func (bot *robot) handleNoteEvent(e *sdk.NoteEvent, c config.Config, log *logrus.Entry) error {
// TODO: if it doesn't needd to hand Note event, delete this function.
return nil
}