Skip to content

Commit 20e6fc6

Browse files
committed
Fix compiling and connect to Discord
1 parent 6fca572 commit 20e6fc6

File tree

3 files changed

+11
-4
lines changed

3 files changed

+11
-4
lines changed

controllers/commit.go

+3-2
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,11 @@ func GetWebhook(ctx *macaron.Context) {
1616
json.Unmarshal(body, &res)
1717

1818
modules.BOT.ChannelMessageSend(modules.CONFIG.Section("DISCORD").Key("channel").String(),
19-
"[" + res.Repo.Name + "] " + res.Pusher.Name + " pushed " + len(res.Commits) + " commits to " + res.Ref + "<" + res.Compare + ">")
19+
"[" + *res.Repo.Name + "] " + *res.Pusher.Name + " pushed " + string(len(res.Commits)) + " commits to " + *res.Ref +
20+
"<" + *res.Compare + ">")
2021
for _, commit := range res.Commits {
2122
modules.BOT.ChannelMessageSend(modules.CONFIG.Section("DISCORD").Key("channel").String(),
22-
res.Repo.Name + "/" + res.Ref + " " + commit.SHA + ": " + commit.Message + " (By " + commit.Author.Name + ")")
23+
*res.Repo.Name + "/" + *res.Ref + " " + *commit.SHA + ": " + *commit.Message + " (By " + *commit.Author.Name + ")")
2324
}
2425
}
2526
}

lexbot.go

+7
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import (
44
"github.com/lexteam/lexbot/controllers"
55
"github.com/lexteam/lexbot/modules"
66
"gopkg.in/macaron.v1"
7+
"fmt"
78
)
89

910
func main() {
@@ -19,4 +20,10 @@ func main() {
1920

2021
// Lets run
2122
s.Run(modules.CONFIG.Section("SERVER").Key("port").Int())
23+
24+
err := modules.BOT.Open()
25+
if err != nil {
26+
fmt.Println("error opening connection", err)
27+
return
28+
}
2229
}

modules/bot.go

+1-2
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,7 @@ func InitBot() {
1414

1515
BOT, err = discordgo.New(
1616
CONFIG.Section("DISCORD").Key("email").String(),
17-
CONFIG.Section("DISCORD").Key("password").String(),
18-
CONFIG.Section("DISCORD").Key("token").String())
17+
CONFIG.Section("DISCORD").Key("password").String())
1918
if err != nil {
2019
fmt.Println("Error creating Discord session", err)
2120
}

0 commit comments

Comments
 (0)