mirror of
https://git.ferricyanide.solutions/A_D/irc-webhooks.git
synced 2024-12-22 23:37:05 +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 := strings.Builder{}
|
||||||
|
|
||||||
outIrcMessage.WriteString(fmt.Sprintf(
|
outIrcMessage.WriteString(fmt.Sprintf(
|
||||||
"[%s] %s pushed %d commits",
|
"[%s] %s pushed %d commit(s)",
|
||||||
pushData.Repository.FullName,
|
pushData.Repository.FullName,
|
||||||
pushData.Pusher.Login,
|
pushData.Pusher.Login,
|
||||||
len(pushData.Commits),
|
len(pushData.Commits),
|
||||||
@ -81,16 +81,17 @@ func handlePush(data []byte, msgChan chan string) {
|
|||||||
func handleIssueAction(data []byte, msgChan chan string) {
|
func handleIssueAction(data []byte, msgChan chan string) {
|
||||||
action := IssueAction{}
|
action := IssueAction{}
|
||||||
json.Unmarshal(data, &action)
|
json.Unmarshal(data, &action)
|
||||||
printSep()
|
outMsg := strings.Builder{}
|
||||||
fmt.Printf(
|
outMsg.WriteString(fmt.Sprintf("[%s] ", action.Repository.FullName))
|
||||||
"%q (%q) performed the action %q on repo %q and issue %q\n",
|
switch action.Action {
|
||||||
action.Sender.Login,
|
case "opened":
|
||||||
action.Sender.Email,
|
outMsg.WriteString(fmt.Sprintf("%s opened an issue: %q", action.Sender.Login, action.Issue.Title))
|
||||||
action.Action,
|
case "closed":
|
||||||
action.Repository.FullName,
|
outMsg.WriteString(fmt.Sprintf("%s closed issue %q", action.Sender.Login, action.Issue.Title))
|
||||||
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 <- 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)
|
}
|
||||||
|
msgChan <- outMsg.String()
|
||||||
}
|
}
|
||||||
|
|
||||||
func handleIssueComment(data []byte, msgChan chan string) {
|
func handleIssueComment(data []byte, msgChan chan string) {
|
||||||
|
Loading…
Reference in New Issue
Block a user