{"action":"created","comment":{"url":"https://api.github.com/repos/gopheracademy/gopher/pulls/comments/85657431","pull_request_review_id":6361771,"id":85657431,"diff_hunk":"@@ -26,41 +26,76 @@ type (\n \t\t\t} `json:\"commit\"`\n \t\t} `json:\"revisions\"`\n \t}\n+\n+\tgoCL struct {\n+\t\tTweeted   bool `datastore:\",noindex\"`\n+\t\tCrawledAt time.Time\n+\t}\n )\n \n func (b *Bot) MonitorGerrit(duration time.Duration) {\n \ttk := time.NewTicker(duration)\n \tdefer tk.Stop()\n \n-\tlastID := \"\"\n+\tgetCLFromDS := func(query *datastore.Query) (*datastore.Key, *goCL, error) {\n+\t\titer := b.dsClient.Run(b.ctx, query)\n \n-\thistoryParams := slack.HistoryParameters{Count: 100}\n-\thistory, err := b.slackBotAPI.GetGroupHistory(b.channels[\"golang_cls\"].slackID, historyParams)\n-\tif err != nil {\n-\t\tb.logf(\"error while fetching history: %v\\n\", err)\n-\t} else {\n-\t\tfor _, msg := range history.Messages {\n-\t\t\tif msg.User != b.id {\n-\t\t\t\tcontinue\n-\t\t\t}\n-\t\t\tif len(msg.Attachments) != 1 {\n-\t\t\t\tcontinue\n-\t\t\t}\n-\t\t\tlastID = strings.ToLower(msg.Attachments[0].Footer)\n-\t\t\tbreak\n+\t\tdst := &goCL{}","path":"bot/gerrit.go","position":50,"original_position":50,"commit_id":"e97a623555e937ec3eb5e34b8471ae194786f9ec","original_commit_id":"0004f0bcf66621dcc3eacd50bf76e07549f24d54","user":{"login":"dlsniper","id":607868,"avatar_url":"https://avatars.githubusercontent.com/u/607868?v=3","gravatar_id":"","url":"https://api.github.com/users/dlsniper","html_url":"https://github.com/dlsniper","followers_url":"https://api.github.com/users/dlsniper/followers","following_url":"https://api.github.com/users/dlsniper/following{/other_user}","gists_url":"https://api.github.com/users/dlsniper/gists{/gist_id}","starred_url":"https://api.github.com/users/dlsniper/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dlsniper/subscriptions","organizations_url":"https://api.github.com/users/dlsniper/orgs","repos_url":"https://api.github.com/users/dlsniper/repos","events_url":"https://api.github.com/users/dlsniper/events{/privacy}","received_events_url":"https://api.github.com/users/dlsniper/received_events","type":"User","site_admin":false},"body":"it seems simpler than to do it like this: \r\n```go\r\n\tgetCLFromDS := func(query *datastore.Query) (*datastore.Key, *goCL, error) {\r\n\t\titer := b.dsClient.Run(b.ctx, query)\r\n\r\n\t\tvar dst goCL\r\n\t\tkey, err := iter.Next(&dst)\r\n\t\tif err != nil && err != datastore.Done {\r\n\t\t\tb.logf(\"error while fetching history: %v\\n\", err)\r\n\t\t\treturn nil, nil, err\r\n\t\t}\r\n\r\n\t\treturn key, &dst, nil\r\n\t}\r\n```","created_at":"2016-10-30T11:00:13Z","updated_at":"2016-10-30T11:00:13Z","html_url":"https://github.com/gopheracademy/gopher/pull/5#discussion_r85657431","pull_request_url":"https://api.github.com/repos/gopheracademy/gopher/pulls/5","_links":{"self":{"href":"https://api.github.com/repos/gopheracademy/gopher/pulls/comments/85657431"},"html":{"href":"https://github.com/gopheracademy/gopher/pull/5#discussion_r85657431"},"pull_request":{"href":"https://api.github.com/repos/gopheracademy/gopher/pulls/5"}}},"pull_request":{"url":"https://api.github.com/repos/gopheracademy/gopher/pulls/5","id":91500309,"html_url":"https://github.com/gopheracademy/gopher/pull/5","diff_url":"https://github.com/gopheracademy/gopher/pull/5.diff","patch_url":"https://github.com/gopheracademy/gopher/pull/5.patch","issue_url":"https://api.github.com/repos/gopheracademy/gopher/issues/5","number":5,"state":"closed","locked":false,"title":"Use Cloud Datastore to store the tweet ID and status","user":{"login":"dlsniper","id":607868,"avatar_url":"https://avatars.githubusercontent.com/u/607868?v=3","gravatar_id":"","url":"https://api.github.com/users/dlsniper","html_url":"https://github.com/dlsniper","followers_url":"https://api.github.com/users/dlsniper/followers","following_url":"https://api.github.com/users/dlsniper/following{/other_user}","gists_url":"https://api.github.com/users/dlsniper/gists{/gist_id}","starred_url":"https://api.github.com/users/dlsniper/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dlsniper/subscriptions","organizations_url":"https://api.github.com/users/dlsniper/orgs","repos_url":"https://api.github.com/users/dlsniper/repos","events_url":"https://api.github.com/users/dlsniper/events{/privacy}","received_events_url":"https://api.github.com/users/dlsniper/received_events","type":"User","site_admin":false},"body":"","created_at":"2016-10-29T20:04:42Z","updated_at":"2016-10-30T11:00:13Z","closed_at":"2016-10-29T23:10:07Z","merged_at":"2016-10-29T23:10:07Z","merge_commit_sha":"7dcea32fd9cc9f41f0e521f9ff347f7aecbea4d6","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/gopheracademy/gopher/pulls/5/commits","review_comments_url":"https://api.github.com/repos/gopheracademy/gopher/pulls/5/comments","review_comment_url":"https://api.github.com/repos/gopheracademy/gopher/pulls/comments{/number}","comments_url":"https://api.github.com/repos/gopheracademy/gopher/issues/5/comments","statuses_url":"https://api.github.com/repos/gopheracademy/gopher/statuses/e97a623555e937ec3eb5e34b8471ae194786f9ec","head":{"label":"gopheracademy:datastore","ref":"datastore","sha":"e97a623555e937ec3eb5e34b8471ae194786f9ec","user":{"login":"gopheracademy","id":7428627,"avatar_url":"https://avatars.githubusercontent.com/u/7428627?v=3","gravatar_id":"","url":"https://api.github.com/users/gopheracademy","html_url":"https://github.com/gopheracademy","followers_url":"https://api.github.com/users/gopheracademy/followers","following_url":"https://api.github.com/users/gopheracademy/following{/other_user}","gists_url":"https://api.github.com/users/gopheracademy/gists{/gist_id}","starred_url":"https://api.github.com/users/gopheracademy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gopheracademy/subscriptions","organizations_url":"https://api.github.com/users/gopheracademy/orgs","repos_url":"https://api.github.com/users/gopheracademy/repos","events_url":"https://api.github.com/users/gopheracademy/events{/privacy}","received_events_url":"https://api.github.com/users/gopheracademy/received_events","type":"Organization","site_admin":false},"repo":{"id":62717031,"name":"gopher","full_name":"gopheracademy/gopher","owner":{"login":"gopheracademy","id":7428627,"avatar_url":"https://avatars.githubusercontent.com/u/7428627?v=3","gravatar_id":"","url":"https://api.github.com/users/gopheracademy","html_url":"https://github.com/gopheracademy","followers_url":"https://api.github.com/users/gopheracademy/followers","following_url":"https://api.github.com/users/gopheracademy/following{/other_user}","gists_url":"https://api.github.com/users/gopheracademy/gists{/gist_id}","starred_url":"https://api.github.com/users/gopheracademy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gopheracademy/subscriptions","organizations_url":"https://api.github.com/users/gopheracademy/orgs","repos_url":"https://api.github.com/users/gopheracademy/repos","events_url":"https://api.github.com/users/gopheracademy/events{/privacy}","received_events_url":"https://api.github.com/users/gopheracademy/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/gopheracademy/gopher","description":"Slack bot for Gophers slack https://invite.slack.golangbridge.org","fork":false,"url":"https://api.github.com/repos/gopheracademy/gopher","forks_url":"https://api.github.com/repos/gopheracademy/gopher/forks","keys_url":"https://api.github.com/repos/gopheracademy/gopher/keys{/key_id}","collaborators_url":"https://api.github.com/repos/gopheracademy/gopher/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/gopheracademy/gopher/teams","hooks_url":"https://api.github.com/repos/gopheracademy/gopher/hooks","issue_events_url":"https://api.github.com/repos/gopheracademy/gopher/issues/events{/number}","events_url":"https://api.github.com/repos/gopheracademy/gopher/events","assignees_url":"https://api.github.com/repos/gopheracademy/gopher/assignees{/user}","branches_url":"https://api.github.com/repos/gopheracademy/gopher/branches{/branch}","tags_url":"https://api.github.com/repos/gopheracademy/gopher/tags","blobs_url":"https://api.github.com/repos/gopheracademy/gopher/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/gopheracademy/gopher/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/gopheracademy/gopher/git/refs{/sha}","trees_url":"https://api.github.com/repos/gopheracademy/gopher/git/trees{/sha}","statuses_url":"https://api.github.com/repos/gopheracademy/gopher/statuses/{sha}","languages_url":"https://api.github.com/repos/gopheracademy/gopher/languages","stargazers_url":"https://api.github.com/repos/gopheracademy/gopher/stargazers","contributors_url":"https://api.github.com/repos/gopheracademy/gopher/contributors","subscribers_url":"https://api.github.com/repos/gopheracademy/gopher/subscribers","subscription_url":"https://api.github.com/repos/gopheracademy/gopher/subscription","commits_url":"https://api.github.com/repos/gopheracademy/gopher/commits{/sha}","git_commits_url":"https://api.github.com/repos/gopheracademy/gopher/git/commits{/sha}","comments_url":"https://api.github.com/repos/gopheracademy/gopher/comments{/number}","issue_comment_url":"https://api.github.com/repos/gopheracademy/gopher/issues/comments{/number}","contents_url":"https://api.github.com/repos/gopheracademy/gopher/contents/{+path}","compare_url":"https://api.github.com/repos/gopheracademy/gopher/compare/{base}...{head}","merges_url":"https://api.github.com/repos/gopheracademy/gopher/merges","archive_url":"https://api.github.com/repos/gopheracademy/gopher/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/gopheracademy/gopher/downloads","issues_url":"https://api.github.com/repos/gopheracademy/gopher/issues{/number}","pulls_url":"https://api.github.com/repos/gopheracademy/gopher/pulls{/number}","milestones_url":"https://api.github.com/repos/gopheracademy/gopher/milestones{/number}","notifications_url":"https://api.github.com/repos/gopheracademy/gopher/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/gopheracademy/gopher/labels{/name}","releases_url":"https://api.github.com/repos/gopheracademy/gopher/releases{/id}","deployments_url":"https://api.github.com/repos/gopheracademy/gopher/deployments","created_at":"2016-07-06T11:46:52Z","updated_at":"2016-10-27T02:34:39Z","pushed_at":"2016-10-30T10:37:11Z","git_url":"git://github.com/gopheracademy/gopher.git","ssh_url":"git@github.com:gopheracademy/gopher.git","clone_url":"https://github.com/gopheracademy/gopher.git","svn_url":"https://github.com/gopheracademy/gopher","homepage":null,"size":717,"stargazers_count":14,"watchers_count":14,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":4,"mirror_url":null,"open_issues_count":0,"forks":4,"open_issues":0,"watchers":14,"default_branch":"master"}},"base":{"label":"gopheracademy:master","ref":"master","sha":"a43b34f9b4b81486a37771f9e94e74e977e98763","user":{"login":"gopheracademy","id":7428627,"avatar_url":"https://avatars.githubusercontent.com/u/7428627?v=3","gravatar_id":"","url":"https://api.github.com/users/gopheracademy","html_url":"https://github.com/gopheracademy","followers_url":"https://api.github.com/users/gopheracademy/followers","following_url":"https://api.github.com/users/gopheracademy/following{/other_user}","gists_url":"https://api.github.com/users/gopheracademy/gists{/gist_id}","starred_url":"https://api.github.com/users/gopheracademy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gopheracademy/subscriptions","organizations_url":"https://api.github.com/users/gopheracademy/orgs","repos_url":"https://api.github.com/users/gopheracademy/repos","events_url":"https://api.github.com/users/gopheracademy/events{/privacy}","received_events_url":"https://api.github.com/users/gopheracademy/received_events","type":"Organization","site_admin":false},"repo":{"id":62717031,"name":"gopher","full_name":"gopheracademy/gopher","owner":{"login":"gopheracademy","id":7428627,"avatar_url":"https://avatars.githubusercontent.com/u/7428627?v=3","gravatar_id":"","url":"https://api.github.com/users/gopheracademy","html_url":"https://github.com/gopheracademy","followers_url":"https://api.github.com/users/gopheracademy/followers","following_url":"https://api.github.com/users/gopheracademy/following{/other_user}","gists_url":"https://api.github.com/users/gopheracademy/gists{/gist_id}","starred_url":"https://api.github.com/users/gopheracademy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gopheracademy/subscriptions","organizations_url":"https://api.github.com/users/gopheracademy/orgs","repos_url":"https://api.github.com/users/gopheracademy/repos","events_url":"https://api.github.com/users/gopheracademy/events{/privacy}","received_events_url":"https://api.github.com/users/gopheracademy/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/gopheracademy/gopher","description":"Slack bot for Gophers slack https://invite.slack.golangbridge.org","fork":false,"url":"https://api.github.com/repos/gopheracademy/gopher","forks_url":"https://api.github.com/repos/gopheracademy/gopher/forks","keys_url":"https://api.github.com/repos/gopheracademy/gopher/keys{/key_id}","collaborators_url":"https://api.github.com/repos/gopheracademy/gopher/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/gopheracademy/gopher/teams","hooks_url":"https://api.github.com/repos/gopheracademy/gopher/hooks","issue_events_url":"https://api.github.com/repos/gopheracademy/gopher/issues/events{/number}","events_url":"https://api.github.com/repos/gopheracademy/gopher/events","assignees_url":"https://api.github.com/repos/gopheracademy/gopher/assignees{/user}","branches_url":"https://api.github.com/repos/gopheracademy/gopher/branches{/branch}","tags_url":"https://api.github.com/repos/gopheracademy/gopher/tags","blobs_url":"https://api.github.com/repos/gopheracademy/gopher/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/gopheracademy/gopher/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/gopheracademy/gopher/git/refs{/sha}","trees_url":"https://api.github.com/repos/gopheracademy/gopher/git/trees{/sha}","statuses_url":"https://api.github.com/repos/gopheracademy/gopher/statuses/{sha}","languages_url":"https://api.github.com/repos/gopheracademy/gopher/languages","stargazers_url":"https://api.github.com/repos/gopheracademy/gopher/stargazers","contributors_url":"https://api.github.com/repos/gopheracademy/gopher/contributors","subscribers_url":"https://api.github.com/repos/gopheracademy/gopher/subscribers","subscription_url":"https://api.github.com/repos/gopheracademy/gopher/subscription","commits_url":"https://api.github.com/repos/gopheracademy/gopher/commits{/sha}","git_commits_url":"https://api.github.com/repos/gopheracademy/gopher/git/commits{/sha}","comments_url":"https://api.github.com/repos/gopheracademy/gopher/comments{/number}","issue_comment_url":"https://api.github.com/repos/gopheracademy/gopher/issues/comments{/number}","contents_url":"https://api.github.com/repos/gopheracademy/gopher/contents/{+path}","compare_url":"https://api.github.com/repos/gopheracademy/gopher/compare/{base}...{head}","merges_url":"https://api.github.com/repos/gopheracademy/gopher/merges","archive_url":"https://api.github.com/repos/gopheracademy/gopher/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/gopheracademy/gopher/downloads","issues_url":"https://api.github.com/repos/gopheracademy/gopher/issues{/number}","pulls_url":"https://api.github.com/repos/gopheracademy/gopher/pulls{/number}","milestones_url":"https://api.github.com/repos/gopheracademy/gopher/milestones{/number}","notifications_url":"https://api.github.com/repos/gopheracademy/gopher/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/gopheracademy/gopher/labels{/name}","releases_url":"https://api.github.com/repos/gopheracademy/gopher/releases{/id}","deployments_url":"https://api.github.com/repos/gopheracademy/gopher/deployments","created_at":"2016-07-06T11:46:52Z","updated_at":"2016-10-27T02:34:39Z","pushed_at":"2016-10-30T10:37:11Z","git_url":"git://github.com/gopheracademy/gopher.git","ssh_url":"git@github.com:gopheracademy/gopher.git","clone_url":"https://github.com/gopheracademy/gopher.git","svn_url":"https://github.com/gopheracademy/gopher","homepage":null,"size":717,"stargazers_count":14,"watchers_count":14,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":4,"mirror_url":null,"open_issues_count":0,"forks":4,"open_issues":0,"watchers":14,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/gopheracademy/gopher/pulls/5"},"html":{"href":"https://github.com/gopheracademy/gopher/pull/5"},"issue":{"href":"https://api.github.com/repos/gopheracademy/gopher/issues/5"},"comments":{"href":"https://api.github.com/repos/gopheracademy/gopher/issues/5/comments"},"review_comments":{"href":"https://api.github.com/repos/gopheracademy/gopher/pulls/5/comments"},"review_comment":{"href":"https://api.github.com/repos/gopheracademy/gopher/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/gopheracademy/gopher/pulls/5/commits"},"statuses":{"href":"https://api.github.com/repos/gopheracademy/gopher/statuses/e97a623555e937ec3eb5e34b8471ae194786f9ec"}}}}
{"actor":{"display_login":"dlsniper"}}