Skip to content

Commit a58c118

Browse files
committed
Fix everything up
Turns out i had an outdated version of go-github
1 parent 20e6fc6 commit a58c118

File tree

3 files changed

+7
-8
lines changed

3 files changed

+7
-8
lines changed

controllers/commit.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import (
66
"github.com/google/go-github/github"
77
"github.com/lexteam/lexbot/modules"
88
"gopkg.in/macaron.v1"
9+
"strconv"
910
)
1011

1112
func GetWebhook(ctx *macaron.Context) {
@@ -16,11 +17,11 @@ func GetWebhook(ctx *macaron.Context) {
1617
json.Unmarshal(body, &res)
1718

1819
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+
2122
for _, commit := range res.Commits {
2223
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 + ")")
2425
}
2526
}
2627
}

lexbot.example.ini

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,3 @@ email = [email protected]
33
password = password123
44
token = atokengoeshere
55
channel = achannelgoeshere
6-
7-
[SERVER]
8-
port = 9000

lexbot.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,10 @@ func main() {
1818
// Routes
1919
s.Post("/commit", controllers.GetWebhook)
2020

21-
// Lets run
22-
s.Run(modules.CONFIG.Section("SERVER").Key("port").Int())
21+
// Run webserver
22+
s.Run()
2323

24+
// Run Discord bot
2425
err := modules.BOT.Open()
2526
if err != nil {
2627
fmt.Println("error opening connection", err)

0 commit comments

Comments
 (0)