// Activity(dashboard.atpm)の表示。XMLパースなので情報欠落が辛い感じ。廃止予定 func printActivity(gitlab *gogitlab.Gitlab) { feed, err := gitlab.Activity() if err != nil { log.Fatal(err.Error()) return } currentUser, err := gitlab.CurrentUser() if err != nil { log.Fatal(err.Error()) return } for _, feedCommit := range feed.Entries { feedCommentText := createFeedCommentText(¤tUser, feedCommit) fmt.Println(feedCommentText) } }
func tickGitlabActivity(gitlab *gogitlab.Gitlab, tickSecond int) { ch := time.Tick(time.Second * time.Duration(10)) lastedFeed, err := gitlab.Activity() if err != nil { log.Fatal(err.Error()) return } currentUser, err := gitlab.CurrentUser() if err != nil { log.Fatal(err.Error()) return } for i := len(lastedFeed.Entries) - 1; i >= 0; i-- { feedCommentText := createFeedCommentText(¤tUser, lastedFeed.Entries[i]) fmt.Println(feedCommentText) } for now := range ch { emoji.Printf("@{:beer:}[%v] tick \n", now) feed, err := gitlab.Activity() if err != nil { log.Fatal(err.Error()) return } for i := len(feed.Entries) - 1; i >= 0; i-- { feedComment := feed.Entries[i] if feedComment.Updated.After(lastedFeed.Entries[0].Updated) { feedCommentText := createFeedShortCommentText(feedComment) fmt.Println(feedCommentText) Notifier(feedCommentText, feedComment.Id, feedComment.Summary, "") } } lastedFeed = feed } }