Browse Source

error-check !github react before calling Github

Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
pull/197/head
Michael Telatynski 7 years ago
parent
commit
e8a4b1eda5
No known key found for this signature in database GPG Key ID: 3F879DA5AD802A5E
  1. 3
      src/github.com/matrix-org/go-neb/services/github/github.go

3
src/github.com/matrix-org/go-neb/services/github/github.go

@ -151,6 +151,9 @@ func (s *Service) cmdGithubReact(roomID, userID string, args []string) (interfac
if len(args) < 2 { if len(args) < 2 {
return &gomatrix.TextMessage{"m.notice", "Usage: " + cmdGithubReactUsage}, nil return &gomatrix.TextMessage{"m.notice", "Usage: " + cmdGithubReactUsage}, nil
} }
if args[1] != "+1" && args[1] != "-1" && args[1] != "laugh" && args[1] != "confused" && args[1] != "heart" && args[1] != "hooray" {
return &gomatrix.TextMessage{"m.notice", "Invalid reaction. Usage: " + cmdGithubReactUsage}, nil
}
// get owner,repo,issue,resp out of args[0] // get owner,repo,issue,resp out of args[0]
owner, repo, issueNum, resp := s.getIssueDetailsFor(args[0], roomID, cmdGithubReactUsage) owner, repo, issueNum, resp := s.getIssueDetailsFor(args[0], roomID, cmdGithubReactUsage)

Loading…
Cancel
Save