File tree Expand file tree Collapse file tree 3 files changed +7
-8
lines changed Expand file tree Collapse file tree 3 files changed +7
-8
lines changed Original file line number Diff line number Diff line change 6
6
"github.com/google/go-github/github"
7
7
"github.com/lexteam/lexbot/modules"
8
8
"gopkg.in/macaron.v1"
9
+ "strconv"
9
10
)
10
11
11
12
func GetWebhook (ctx * macaron.Context ) {
@@ -16,11 +17,11 @@ func GetWebhook(ctx *macaron.Context) {
16
17
json .Unmarshal (body , & res )
17
18
18
19
modules .BOT .ChannelMessageSend (modules .CONFIG .Section ("DISCORD" ).Key ("channel" ).String (),
19
- "[" + * res .Repo .Name + "] " + * res .Pusher .Name + " pushed " + string (len (res .Commits )) + " commits to " + * res .Ref +
20
- "<" + * res . Compare + ">" )
20
+ "[" + * res .Repo .Name + "] " + * res .Pusher .Name + " pushed " + strconv . Itoa (len (res .Commits )) + " commits to " + * res .Ref + " " + * res . Compare )
21
+
21
22
for _ , commit := range res .Commits {
22
23
modules .BOT .ChannelMessageSend (modules .CONFIG .Section ("DISCORD" ).Key ("channel" ).String (),
23
- * res .Repo .Name + "/" + * res .Ref + " " + * commit .SHA + ": " + * commit .Message + " (By " + * commit .Author .Name + ")" )
24
+ * res .Repo .Name + "/" + * res .Ref + " " + * commit .ID + ": " + * commit .Message + " (By " + * commit .Author .Name + ")" )
24
25
}
25
26
}
26
27
}
Original file line number Diff line number Diff line change 3
3
password = password123
4
4
token = atokengoeshere
5
5
channel = achannelgoeshere
6
-
7
- [SERVER]
8
- port = 9000
Original file line number Diff line number Diff line change @@ -18,9 +18,10 @@ func main() {
18
18
// Routes
19
19
s .Post ("/commit" , controllers .GetWebhook )
20
20
21
- // Lets run
22
- s .Run (modules . CONFIG . Section ( "SERVER" ). Key ( "port" ). Int () )
21
+ // Run webserver
22
+ s .Run ()
23
23
24
+ // Run Discord bot
24
25
err := modules .BOT .Open ()
25
26
if err != nil {
26
27
fmt .Println ("error opening connection" , err )
You can’t perform that action at this time.
0 commit comments