diff --git a/bot/main.go b/bot/main.go index e702867..fd955af 100644 --- a/bot/main.go +++ b/bot/main.go @@ -1,6 +1,6 @@ package main -var version = "v0.02" +var version = "v0.03" func main() { initGitHubClient(version) diff --git a/bot/utils.go b/bot/utils.go index 508e666..9961a98 100644 --- a/bot/utils.go +++ b/bot/utils.go @@ -177,10 +177,11 @@ func processIssueCommentEvent(event *github.IssueCommentEvent) { } return - } else { - commentText := "Votes: (#{reactionCount})/(#{reactionCountGoal})" - commentText = strings.Replace(commentText, "(#{reactionCount})", strconv.Itoa(len(approvals)), 1) - commentText = strings.Replace(commentText, "(#{reactionCountGoal})", strconv.Itoa(reactionCountGoal), 1) + } + + if approvals[eventSender] > 1 { + commentText := "@(#{commentAuthor}) your vote has already been counted :x:" + commentText = strings.Replace(commentText, "(#{commentAuthor})", eventSender, 1) // Respond with a comment comment := &github.IssueComment{ @@ -191,11 +192,10 @@ func processIssueCommentEvent(event *github.IssueCommentEvent) { if err != nil { log.Println("Error creating comment:", err) } - } - - if approvals[eventSender] > 1 { - commentText := "@(#{commentAuthor}) your vote has already been counted :x:" - commentText = strings.Replace(commentText, "(#{commentAuthor})", eventSender, 1) + } else { + commentText := "@(#{commentAuthor}) voted! :tada:\n" + "Votes: (#{reactionCount})/(#{reactionCountGoal})" + commentText = strings.Replace(commentText, "(#{reactionCount})", strconv.Itoa(len(approvals)), 1) + commentText = strings.Replace(commentText, "(#{reactionCountGoal})", strconv.Itoa(reactionCountGoal), 1) // Respond with a comment comment := &github.IssueComment{