mirror of
https://git.ferricyanide.solutions/A_D/irc-webhooks.git
synced 2024-12-22 18:37:06 +00:00
refined messages slightly
This commit is contained in:
parent
246da11334
commit
2a54c81da1
@ -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) {
|
||||
|
Loading…
Reference in New Issue
Block a user