Skip to content
This repository has been archived by the owner on Jun 22, 2023. It is now read-only.

Commit

Permalink
fix PR不能显示的问题
Browse files Browse the repository at this point in the history
  • Loading branch information
mcoo committed Jun 2, 2021
1 parent 262f943 commit 43ccc4b
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions githubManager/hookManager.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,6 @@ func NewManager(app *iris.Application, bot *OPQBot.BotManager) Manager {
return
}
}
log.Println(payload)
switch v := payload.(type) {
case github.PingPayload:
log.Println(v)
Expand All @@ -113,6 +112,9 @@ func NewManager(app *iris.Application, bot *OPQBot.BotManager) Manager {
for _, v1 := range v.Commits {
commitString = append(commitString, fmt.Sprintf("[%s] %s", v1.Timestamp, v1.Message))
}
if len(commitString) == 0 {
return
}
r, _ := requests.Get(v.Sender.AvatarURL)
for _, v1 := range h.Groups {
m.b.SendGroupPicMsg(v1, fmt.Sprintf("%s\nCommit:\n%s", v.Repository.FullName, strings.Join(commitString, "\n")), r.Content())
Expand All @@ -124,8 +126,9 @@ func NewManager(app *iris.Application, bot *OPQBot.BotManager) Manager {

}
case github.PullRequestPayload:
r, _ := requests.Get(v.Sender.AvatarURL)
for _, v1 := range h.Groups {
m.b.SendGroupTextMsg(v1, fmt.Sprintf("%s\nPR: %s", v.Repository.FullName, v.PullRequest.Body))
m.b.SendGroupPicMsg(v1, fmt.Sprintf("%s\nPR:\n%s to %s", v.Repository.FullName, v.PullRequest.Head.Label, v.PullRequest.Base.Label), r.Content())
}

}
Expand Down

0 comments on commit 43ccc4b

Please sign in to comment.