refined messages slightly

This commit is contained in:
A_D 2018-11-17 21:22:39 +02:00
parent 246da11334
commit 2a54c81da1
No known key found for this signature in database
GPG Key ID: C242F3DD220FA945

View File

@ -68,7 +68,7 @@ func handlePush(data []byte, msgChan chan string) {
outIrcMessage := strings.Builder{}
outIrcMessage.WriteString(fmt.Sprintf(
"[%s] %s pushed %d commits",
"[%s] %s pushed %d commit(s)",
pushData.Repository.FullName,
pushData.Pusher.Login,
len(pushData.Commits),
@ -81,16 +81,17 @@ func handlePush(data []byte, msgChan chan string) {
func handleIssueAction(data []byte, msgChan chan string) {
action := IssueAction{}
json.Unmarshal(data, &action)
printSep()
fmt.Printf(
"%q (%q) performed the action %q on repo %q and issue %q\n",
action.Sender.Login,
action.Sender.Email,
action.Action,
action.Repository.FullName,
action.Issue.Title,
)
msgChan <- fmt.Sprintf("[%s] %s performed the action %s on issue %f (%s)", action.Repository.FullName, action.Sender.Login, action.Action, action.Issue.Id, action.Issue.Title)
outMsg := strings.Builder{}
outMsg.WriteString(fmt.Sprintf("[%s] ", action.Repository.FullName))
switch action.Action {
case "opened":
outMsg.WriteString(fmt.Sprintf("%s opened an issue: %q", action.Sender.Login, action.Issue.Title))
case "closed":
outMsg.WriteString(fmt.Sprintf("%s closed issue %q", action.Sender.Login, action.Issue.Title))
default:
outMsg.WriteString(fmt.Sprintf("%s performed an unknown action (%s) on issue %f", action.Sender.Login, action.Action, action.Issue.Id))
}
msgChan <- outMsg.String()
}
func handleIssueComment(data []byte, msgChan chan string) {