Fix votes only being showed after a new vote and chris fixed everything

This commit is contained in:
Sebastian Cabrera 2023-08-30 19:43:42 -04:00
parent 194d13d039
commit 6b1880cff7
2 changed files with 10 additions and 10 deletions

View file

@ -1,6 +1,6 @@
package main
var version = "v0.02"
var version = "v0.03"
func main() {
initGitHubClient(version)

View file

@ -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{