|
|
@ -45,12 +45,8 @@ func (s *githubService) RoomIDs() []string { |
|
|
|
} |
|
|
|
return keys |
|
|
|
} |
|
|
|
func (s *githubService) Plugin(roomID string) plugin.Plugin { |
|
|
|
return plugin.Plugin{ |
|
|
|
Commands: []plugin.Command{ |
|
|
|
plugin.Command{ |
|
|
|
Path: []string{"github", "create"}, |
|
|
|
Command: func(roomID, userID string, args []string) (interface{}, error) { |
|
|
|
|
|
|
|
func (s *githubService) cmdGithubCreate(roomID, userID string, args []string) (interface{}, error) { |
|
|
|
cli := s.githubClientFor(userID, false) |
|
|
|
if cli == nil { |
|
|
|
// TODO: send starter link
|
|
|
@ -95,13 +91,9 @@ func (s *githubService) Plugin(roomID string) plugin.Plugin { |
|
|
|
} |
|
|
|
|
|
|
|
return matrix.TextMessage{"m.notice", fmt.Sprintf("Created issue: %s", *issue.HTMLURL)}, nil |
|
|
|
}, |
|
|
|
}, |
|
|
|
}, |
|
|
|
Expansions: []plugin.Expansion{ |
|
|
|
plugin.Expansion{ |
|
|
|
Regexp: ownerRepoIssueRegex, |
|
|
|
Expand: func(roomID, userID, matchingText string) interface{} { |
|
|
|
} |
|
|
|
|
|
|
|
func (s *githubService) expandIssue(roomID, userID, matchingText string) interface{} { |
|
|
|
cli := s.githubClientFor(userID, true) |
|
|
|
owner, repo, num, err := ownerRepoNumberFromText(matchingText) |
|
|
|
if err != nil { |
|
|
@ -124,6 +116,23 @@ func (s *githubService) Plugin(roomID string) plugin.Plugin { |
|
|
|
"m.notice", |
|
|
|
fmt.Sprintf("%s : %s", *i.HTMLURL, *i.Title), |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
func (s *githubService) Plugin(roomID string) plugin.Plugin { |
|
|
|
return plugin.Plugin{ |
|
|
|
Commands: []plugin.Command{ |
|
|
|
plugin.Command{ |
|
|
|
Path: []string{"github", "create"}, |
|
|
|
Command: func(roomID, userID string, args []string) (interface{}, error) { |
|
|
|
return s.cmdGithubCreate(roomID, userID, args) |
|
|
|
}, |
|
|
|
}, |
|
|
|
}, |
|
|
|
Expansions: []plugin.Expansion{ |
|
|
|
plugin.Expansion{ |
|
|
|
Regexp: ownerRepoIssueRegex, |
|
|
|
Expand: func(roomID, userID, matchingText string) interface{} { |
|
|
|
return s.expandIssue(roomID, userID, matchingText) |
|
|
|
}, |
|
|
|
}, |
|
|
|
}, |
|
|
|