func commitReplied(c *integram.Context, baseURL string, projectID int, commitID string) error { c.Message.SetReplyAction(commitReplied, baseURL, projectID, commitID) c.SetServiceBaseURL(baseURL) authorized, err := mustBeAuthed(c) if !authorized { return c.User.SetAfterAuthAction(sendCommitComment, c, projectID, commitID, c.Message) } c.Service().DoJob(sendCommitComment, c, projectID, commitID, c.Message) return err }
func snippetReplied(c *integram.Context, baseURL string, projectID int, snippetID int) error { c.SetServiceBaseURL(baseURL) authorized, err := mustBeAuthed(c) if !authorized { c.User.SetAfterAuthAction(sendSnippetComment, baseURL, projectID, snippetID, c.Message.Text) } else { _, err = c.Service().DoJob(sendSnippetComment, c, baseURL, projectID, snippetID, c.Message.Text) } c.Message.SetReplyAction(mrReplied, baseURL, projectID, snippetID) return err }
// we nee msg param because action c.Message can contains selected commit id from prev state at commitsReplied and not the comment message func commitToReplySelected(c *integram.Context, baseURL string, projectID int, msg *integram.IncomingMessage) error { commitID, _ := c.KeyboardAnswer() c.Message.SetReplyAction(commitReplied, baseURL, projectID, commitID) c.SetServiceBaseURL(baseURL) authorized, err := mustBeAuthed(c) if !authorized { return c.User.SetAfterAuthAction(sendCommitComment, c, projectID, commitID, msg.Text) } c.Service().DoJob(sendCommitComment, projectID, commitID) return err }
func oAuthSuccessful(c *integram.Context) error { c.Service().SheduleJob(cacheNickMap, 0, time.Now().Add(time.Second*5), c) return c.NewMessage().SetText("Great! Now you can reply issues, commits, merge requests and snippets").Send() }