public IssuesPayload(Event issuesEvent) { Event.Load Payload = issuesEvent.Payload; action = Payload.action; Event.SimplifiedIssue issue = Payload.issue != null ? Payload.issue : Payload.pull_request; number = issue.number; title = issue.title; html_url = Payload.comment != null ? Payload.comment.html_url : issue.html_url; }
public CommitCommentPayload(Event commentEvent) { html_url = commentEvent.Payload.comment.html_url; }
private string[] ParseEventInfo(Event parse) { switch (parse.Type) { case "IssuesEvent": { if (!HasIssues) { return new string[0]; } IssuesPayload payload = new IssuesPayload(parse); return new string[] { Bot.ColorGeneral + "[" + Bot.ColorHighlightMinor + parse.Repo.name + Bot.ColorGeneral + "] " + Bot.ColorHighlightMajor + parse.Actor.login + Bot.ColorGeneral + " " + payload.Action + " an issue: " + Bot.ColorHighlightMajor + payload.Title + Bot.ColorGeneral + " (" + Bot.ColorHighlightMajor + payload.Number + Bot.ColorGeneral + ") --" + Bot.ColorLink + " " + payload.ShortUrl }; } case "IssueCommentEvent": { if (!HasIssues || !HasComments) { return new string[0]; } IssuesPayload payload = new IssuesPayload(parse); return new string[] { Bot.ColorGeneral + "[" + Bot.ColorHighlightMinor + parse.Repo.name + Bot.ColorGeneral + "] " + Bot.ColorHighlightMajor + parse.Actor.login + Bot.ColorGeneral + " commented on an issue: " + Bot.ColorHighlightMajor + payload.Title + Bot.ColorGeneral + " (" + Bot.ColorHighlightMajor + payload.Number + Bot.ColorGeneral + ") --" + Bot.ColorLink + " " + payload.ShortUrl }; } case "PullRequestEvent": { if (!HasPulls) { return new string[0]; } IssuesPayload payload = new IssuesPayload(parse); return new string[] { Bot.ColorGeneral + "[" + Bot.ColorHighlightMinor + parse.Repo.name + Bot.ColorGeneral + "] " + Bot.ColorHighlightMajor + parse.Actor.login + Bot.ColorGeneral + " " + payload.Action + " a pull request: " + Bot.ColorHighlightMajor + payload.Title + Bot.ColorGeneral + " (" + Bot.ColorHighlightMajor + payload.Number + Bot.ColorGeneral + ") --" + Bot.ColorLink + " " + payload.ShortUrl }; } case "PullRequestReviewCommentEvent": { if (!HasPulls || !HasComments) { return new string[0]; } IssuesPayload payload = new IssuesPayload(parse); return new string[] { Bot.ColorGeneral + "[" + Bot.ColorHighlightMinor + parse.Repo.name + Bot.ColorGeneral + "] " + Bot.ColorHighlightMajor + parse.Actor.login + Bot.ColorGeneral + " commented on a pull request: " + Bot.ColorHighlightMajor + payload.Title + Bot.ColorGeneral + " (" + Bot.ColorHighlightMajor + payload.Number + Bot.ColorGeneral + ") --" + Bot.ColorLink + " " + payload.ShortUrl }; } case "CommitCommentEvent": { if (!HasComments) { return new string[0]; } CommitCommentPayload payload = new CommitCommentPayload(parse); return new string[] { Bot.ColorGeneral + "[" + Bot.ColorHighlightMinor + parse.Repo.name + Bot.ColorGeneral + "] " + Bot.ColorHighlightMajor + parse.Actor.login + Bot.ColorGeneral + " commented on a commit: " + Bot.ColorHighlightMajor + payload.CommitId + Bot.ColorGeneral + " --" + Bot.ColorLink + " " + payload.ShortUrl }; } case "PushEvent": { PushEventPayload payload = new PushEventPayload(parse); string Ref = payload.Ref; if (!WaitingCommits.ContainsKey(Ref)) { WaitingCommits[Ref] = new List<Event.SimplifiedCommit>(); } WaitingCommits[Ref].AddRange(payload.Commits); return new string[0]; } default: { return new string[0]; } } }
public PushEventPayload(Event pushEvent) { _ref = pushEvent.Payload._ref; commits = pushEvent.Payload.commits; }