don't always look for a patch
This commit is contained in:
parent
cd3cf11078
commit
20a48b0420
1 changed files with 16 additions and 9 deletions
11
bot.go
11
bot.go
|
@ -93,6 +93,7 @@ func (bot *Bot) NotifyNewEvent(channels []string, newMaps []Event) (err error) {
|
||||||
commit *object.Commit
|
commit *object.Commit
|
||||||
parent *object.Commit
|
parent *object.Commit
|
||||||
patch *object.Patch
|
patch *object.Patch
|
||||||
|
foundPatch = false
|
||||||
// commitFiles *object.FileIter
|
// commitFiles *object.FileIter
|
||||||
)
|
)
|
||||||
beatmapSet, err = bot.getBeatmapsetInfo(event)
|
beatmapSet, err = bot.getBeatmapsetInfo(event)
|
||||||
|
@ -167,13 +168,17 @@ func (bot *Bot) NotifyNewEvent(channels []string, newMaps []Event) (err error) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
parent, err = commit.Parent(0)
|
parent, err = commit.Parent(0)
|
||||||
if err != nil {
|
if err == object.ErrParentNotFound {
|
||||||
|
|
||||||
|
} else if err != nil {
|
||||||
return
|
return
|
||||||
}
|
} else {
|
||||||
patch, err = commit.Patch(parent)
|
patch, err = commit.Patch(parent)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
foundPatch = true
|
||||||
|
}
|
||||||
|
|
||||||
// report diffs
|
// report diffs
|
||||||
}
|
}
|
||||||
|
@ -203,9 +208,11 @@ func (bot *Bot) NotifyNewEvent(channels []string, newMaps []Event) (err error) {
|
||||||
|
|
||||||
if gotDownloadedBeatmap {
|
if gotDownloadedBeatmap {
|
||||||
log.Println(downloadedBeatmap)
|
log.Println(downloadedBeatmap)
|
||||||
|
if foundPatch {
|
||||||
embed.Description = patch.Stats().String()
|
embed.Description = patch.Stats().String()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
for _, channelId := range channels {
|
for _, channelId := range channels {
|
||||||
bot.ChannelMessageSendEmbed(channelId, embed)
|
bot.ChannelMessageSendEmbed(channelId, embed)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue