{"action":"created","comment":{"url":"https://api.github.com/repos/netguru/bob-the-bot/pulls/comments/212237549","pull_request_review_id":148823560,"id":212237549,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIxMjIzNzU0OQ==","diff_hunk":"@@ -0,0 +1,62 @@\n+const { MessageRenderer, RespondMultiplexer } = require('./../../utils');\n+const PropsService = require('./props.service');\n+\n+module.exports = (robot) => {\n+  const propsManager = async (res) => {\n+    const { propsService } = robot.brain;\n+\n+    const propserSlackId = PropsService.getUserSlackId(res);\n+    if (!propserSlackId) {\n+      return res.send('It seems like I can\\'t get your id, make sure you are authenticated');\n+    }\n+\n+    const usersToGivePropsTo = PropsService.getUsersFromMentions(res);\n+\n+    let usersSlackIdsToPropsIds;\n+    try {\n+      usersSlackIdsToPropsIds = await propsService.getUsersFromServer();\n+    } catch (err) {\n+      propsService.serverError(err);\n+      return res.send('It seems like I can\\'t get data from props server :(');\n+    }\n+\n+    if (!propsService.userIsRecognisable(propserSlackId)) {\n+      return res.send('You sure you are signed up for props? I can\\'t find you :(');\n+    }\n+\n+    const unrecognisableUsers = propsService.getUnrecognisableUsers(usersToGivePropsTo)\n+      .map(user => user.info.real_name);\n+\n+    if (unrecognisableUsers.length > 0) {\n+      const response = new MessageRenderer('props/unrecognisable', { users: unrecognisableUsers }).render();\n+      return res.send(response);\n+    }\n+\n+    const textParser = res.match[0].split(/give_props (@\\w+ )+/);\n+\n+    const userIds = usersToGivePropsTo.map(user => usersSlackIdsToPropsIds[user.id]);\n+    const propserId = usersSlackIdsToPropsIds[propserSlackId];\n+    const body = textParser[textParser.length - 1];\n+\n+    try {\n+      await propsService.giveProp(propserId, userIds, body);\n+      return res.send('Success! Props given! 👌');\n+    } catch (err) {\n+      propsService.serverError(err);\n+      return res.send('It seems like I can\\'t get post data to props server :(');","path":"src/props/index.js","position":46,"original_position":46,"commit_id":"fb1076323562b394dc26f05816efc278f112c0da","original_commit_id":"fb1076323562b394dc26f05816efc278f112c0da","user":{"login":"codeclimate[bot]","id":36754821,"node_id":"MDM6Qm90MzY3NTQ4MjE=","avatar_url":"https://avatars0.githubusercontent.com/in/9403?v=4","gravatar_id":"","url":"https://api.github.com/users/codeclimate%5Bbot%5D","html_url":"https://github.com/apps/codeclimate","followers_url":"https://api.github.com/users/codeclimate%5Bbot%5D/followers","following_url":"https://api.github.com/users/codeclimate%5Bbot%5D/following{/other_user}","gists_url":"https://api.github.com/users/codeclimate%5Bbot%5D/gists{/gist_id}","starred_url":"https://api.github.com/users/codeclimate%5Bbot%5D/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/codeclimate%5Bbot%5D/subscriptions","organizations_url":"https://api.github.com/users/codeclimate%5Bbot%5D/orgs","repos_url":"https://api.github.com/users/codeclimate%5Bbot%5D/repos","events_url":"https://api.github.com/users/codeclimate%5Bbot%5D/events{/privacy}","received_events_url":"https://api.github.com/users/codeclimate%5Bbot%5D/received_events","type":"Bot","site_admin":false},"body":"Avoid too many `return` statements within this function.","created_at":"2018-08-23T09:16:15Z","updated_at":"2018-08-23T09:16:16Z","html_url":"https://github.com/netguru/bob-the-bot/pull/23#discussion_r212237549","pull_request_url":"https://api.github.com/repos/netguru/bob-the-bot/pulls/23","author_association":"NONE","_links":{"self":{"href":"https://api.github.com/repos/netguru/bob-the-bot/pulls/comments/212237549"},"html":{"href":"https://github.com/netguru/bob-the-bot/pull/23#discussion_r212237549"},"pull_request":{"href":"https://api.github.com/repos/netguru/bob-the-bot/pulls/23"}}},"pull_request":{"url":"https://api.github.com/repos/netguru/bob-the-bot/pulls/23","id":209859152,"node_id":"MDExOlB1bGxSZXF1ZXN0MjA5ODU5MTUy","html_url":"https://github.com/netguru/bob-the-bot/pull/23","diff_url":"https://github.com/netguru/bob-the-bot/pull/23.diff","patch_url":"https://github.com/netguru/bob-the-bot/pull/23.patch","issue_url":"https://api.github.com/repos/netguru/bob-the-bot/issues/23","number":23,"state":"open","locked":false,"title":"[Feature] Props","user":{"login":"Getriax","id":30323562,"node_id":"MDQ6VXNlcjMwMzIzNTYy","avatar_url":"https://avatars0.githubusercontent.com/u/30323562?v=4","gravatar_id":"","url":"https://api.github.com/users/Getriax","html_url":"https://github.com/Getriax","followers_url":"https://api.github.com/users/Getriax/followers","following_url":"https://api.github.com/users/Getriax/following{/other_user}","gists_url":"https://api.github.com/users/Getriax/gists{/gist_id}","starred_url":"https://api.github.com/users/Getriax/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Getriax/subscriptions","organizations_url":"https://api.github.com/users/Getriax/orgs","repos_url":"https://api.github.com/users/Getriax/repos","events_url":"https://api.github.com/users/Getriax/events{/privacy}","received_events_url":"https://api.github.com/users/Getriax/received_events","type":"User","site_admin":false},"body":"**Task description**\r\n\r\nImplementation of props api, now bob should be able to give props to mentioned users.\r\n\r\ngive_props <users> <text>\r\n\r\n**Examples**\r\ngive_props @some_person some text\r\ngive_props @some_person @another_person some text\r\n\r\nBob needs the **PROPS_API_TOKEN** environment variable to be able to perform that operation\r\n\r\nJira\r\nTECH-90","created_at":"2018-08-21T15:05:48Z","updated_at":"2018-08-23T09:16:15Z","closed_at":null,"merged_at":null,"merge_commit_sha":"dfce635688be744032179894da2bf22350ffafb2","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/netguru/bob-the-bot/pulls/23/commits","review_comments_url":"https://api.github.com/repos/netguru/bob-the-bot/pulls/23/comments","review_comment_url":"https://api.github.com/repos/netguru/bob-the-bot/pulls/comments{/number}","comments_url":"https://api.github.com/repos/netguru/bob-the-bot/issues/23/comments","statuses_url":"https://api.github.com/repos/netguru/bob-the-bot/statuses/fb1076323562b394dc26f05816efc278f112c0da","head":{"label":"netguru:feature/props","ref":"feature/props","sha":"fb1076323562b394dc26f05816efc278f112c0da","user":{"login":"netguru","id":1146,"node_id":"MDEyOk9yZ2FuaXphdGlvbjExNDY=","avatar_url":"https://avatars1.githubusercontent.com/u/1146?v=4","gravatar_id":"","url":"https://api.github.com/users/netguru","html_url":"https://github.com/netguru","followers_url":"https://api.github.com/users/netguru/followers","following_url":"https://api.github.com/users/netguru/following{/other_user}","gists_url":"https://api.github.com/users/netguru/gists{/gist_id}","starred_url":"https://api.github.com/users/netguru/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/netguru/subscriptions","organizations_url":"https://api.github.com/users/netguru/orgs","repos_url":"https://api.github.com/users/netguru/repos","events_url":"https://api.github.com/users/netguru/events{/privacy}","received_events_url":"https://api.github.com/users/netguru/received_events","type":"Organization","site_admin":false},"repo":{"id":141249965,"node_id":"MDEwOlJlcG9zaXRvcnkxNDEyNDk5NjU=","name":"bob-the-bot","full_name":"netguru/bob-the-bot","owner":{"login":"netguru","id":1146,"node_id":"MDEyOk9yZ2FuaXphdGlvbjExNDY=","avatar_url":"https://avatars1.githubusercontent.com/u/1146?v=4","gravatar_id":"","url":"https://api.github.com/users/netguru","html_url":"https://github.com/netguru","followers_url":"https://api.github.com/users/netguru/followers","following_url":"https://api.github.com/users/netguru/following{/other_user}","gists_url":"https://api.github.com/users/netguru/gists{/gist_id}","starred_url":"https://api.github.com/users/netguru/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/netguru/subscriptions","organizations_url":"https://api.github.com/users/netguru/orgs","repos_url":"https://api.github.com/users/netguru/repos","events_url":"https://api.github.com/users/netguru/events{/privacy}","received_events_url":"https://api.github.com/users/netguru/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/netguru/bob-the-bot","description":null,"fork":false,"url":"https://api.github.com/repos/netguru/bob-the-bot","forks_url":"https://api.github.com/repos/netguru/bob-the-bot/forks","keys_url":"https://api.github.com/repos/netguru/bob-the-bot/keys{/key_id}","collaborators_url":"https://api.github.com/repos/netguru/bob-the-bot/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/netguru/bob-the-bot/teams","hooks_url":"https://api.github.com/repos/netguru/bob-the-bot/hooks","issue_events_url":"https://api.github.com/repos/netguru/bob-the-bot/issues/events{/number}","events_url":"https://api.github.com/repos/netguru/bob-the-bot/events","assignees_url":"https://api.github.com/repos/netguru/bob-the-bot/assignees{/user}","branches_url":"https://api.github.com/repos/netguru/bob-the-bot/branches{/branch}","tags_url":"https://api.github.com/repos/netguru/bob-the-bot/tags","blobs_url":"https://api.github.com/repos/netguru/bob-the-bot/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/netguru/bob-the-bot/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/netguru/bob-the-bot/git/refs{/sha}","trees_url":"https://api.github.com/repos/netguru/bob-the-bot/git/trees{/sha}","statuses_url":"https://api.github.com/repos/netguru/bob-the-bot/statuses/{sha}","languages_url":"https://api.github.com/repos/netguru/bob-the-bot/languages","stargazers_url":"https://api.github.com/repos/netguru/bob-the-bot/stargazers","contributors_url":"https://api.github.com/repos/netguru/bob-the-bot/contributors","subscribers_url":"https://api.github.com/repos/netguru/bob-the-bot/subscribers","subscription_url":"https://api.github.com/repos/netguru/bob-the-bot/subscription","commits_url":"https://api.github.com/repos/netguru/bob-the-bot/commits{/sha}","git_commits_url":"https://api.github.com/repos/netguru/bob-the-bot/git/commits{/sha}","comments_url":"https://api.github.com/repos/netguru/bob-the-bot/comments{/number}","issue_comment_url":"https://api.github.com/repos/netguru/bob-the-bot/issues/comments{/number}","contents_url":"https://api.github.com/repos/netguru/bob-the-bot/contents/{+path}","compare_url":"https://api.github.com/repos/netguru/bob-the-bot/compare/{base}...{head}","merges_url":"https://api.github.com/repos/netguru/bob-the-bot/merges","archive_url":"https://api.github.com/repos/netguru/bob-the-bot/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/netguru/bob-the-bot/downloads","issues_url":"https://api.github.com/repos/netguru/bob-the-bot/issues{/number}","pulls_url":"https://api.github.com/repos/netguru/bob-the-bot/pulls{/number}","milestones_url":"https://api.github.com/repos/netguru/bob-the-bot/milestones{/number}","notifications_url":"https://api.github.com/repos/netguru/bob-the-bot/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/netguru/bob-the-bot/labels{/name}","releases_url":"https://api.github.com/repos/netguru/bob-the-bot/releases{/id}","deployments_url":"https://api.github.com/repos/netguru/bob-the-bot/deployments","created_at":"2018-07-17T07:35:10Z","updated_at":"2018-08-23T08:52:24Z","pushed_at":"2018-08-23T09:15:55Z","git_url":"git://github.com/netguru/bob-the-bot.git","ssh_url":"git@github.com:netguru/bob-the-bot.git","clone_url":"https://github.com/netguru/bob-the-bot.git","svn_url":"https://github.com/netguru/bob-the-bot","homepage":null,"size":151,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":4,"license":null,"forks":0,"open_issues":4,"watchers":0,"default_branch":"master"}},"base":{"label":"netguru:master","ref":"master","sha":"07c172f1f37a4d63375be5374219a8625450eff5","user":{"login":"netguru","id":1146,"node_id":"MDEyOk9yZ2FuaXphdGlvbjExNDY=","avatar_url":"https://avatars1.githubusercontent.com/u/1146?v=4","gravatar_id":"","url":"https://api.github.com/users/netguru","html_url":"https://github.com/netguru","followers_url":"https://api.github.com/users/netguru/followers","following_url":"https://api.github.com/users/netguru/following{/other_user}","gists_url":"https://api.github.com/users/netguru/gists{/gist_id}","starred_url":"https://api.github.com/users/netguru/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/netguru/subscriptions","organizations_url":"https://api.github.com/users/netguru/orgs","repos_url":"https://api.github.com/users/netguru/repos","events_url":"https://api.github.com/users/netguru/events{/privacy}","received_events_url":"https://api.github.com/users/netguru/received_events","type":"Organization","site_admin":false},"repo":{"id":141249965,"node_id":"MDEwOlJlcG9zaXRvcnkxNDEyNDk5NjU=","name":"bob-the-bot","full_name":"netguru/bob-the-bot","owner":{"login":"netguru","id":1146,"node_id":"MDEyOk9yZ2FuaXphdGlvbjExNDY=","avatar_url":"https://avatars1.githubusercontent.com/u/1146?v=4","gravatar_id":"","url":"https://api.github.com/users/netguru","html_url":"https://github.com/netguru","followers_url":"https://api.github.com/users/netguru/followers","following_url":"https://api.github.com/users/netguru/following{/other_user}","gists_url":"https://api.github.com/users/netguru/gists{/gist_id}","starred_url":"https://api.github.com/users/netguru/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/netguru/subscriptions","organizations_url":"https://api.github.com/users/netguru/orgs","repos_url":"https://api.github.com/users/netguru/repos","events_url":"https://api.github.com/users/netguru/events{/privacy}","received_events_url":"https://api.github.com/users/netguru/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/netguru/bob-the-bot","description":null,"fork":false,"url":"https://api.github.com/repos/netguru/bob-the-bot","forks_url":"https://api.github.com/repos/netguru/bob-the-bot/forks","keys_url":"https://api.github.com/repos/netguru/bob-the-bot/keys{/key_id}","collaborators_url":"https://api.github.com/repos/netguru/bob-the-bot/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/netguru/bob-the-bot/teams","hooks_url":"https://api.github.com/repos/netguru/bob-the-bot/hooks","issue_events_url":"https://api.github.com/repos/netguru/bob-the-bot/issues/events{/number}","events_url":"https://api.github.com/repos/netguru/bob-the-bot/events","assignees_url":"https://api.github.com/repos/netguru/bob-the-bot/assignees{/user}","branches_url":"https://api.github.com/repos/netguru/bob-the-bot/branches{/branch}","tags_url":"https://api.github.com/repos/netguru/bob-the-bot/tags","blobs_url":"https://api.github.com/repos/netguru/bob-the-bot/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/netguru/bob-the-bot/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/netguru/bob-the-bot/git/refs{/sha}","trees_url":"https://api.github.com/repos/netguru/bob-the-bot/git/trees{/sha}","statuses_url":"https://api.github.com/repos/netguru/bob-the-bot/statuses/{sha}","languages_url":"https://api.github.com/repos/netguru/bob-the-bot/languages","stargazers_url":"https://api.github.com/repos/netguru/bob-the-bot/stargazers","contributors_url":"https://api.github.com/repos/netguru/bob-the-bot/contributors","subscribers_url":"https://api.github.com/repos/netguru/bob-the-bot/subscribers","subscription_url":"https://api.github.com/repos/netguru/bob-the-bot/subscription","commits_url":"https://api.github.com/repos/netguru/bob-the-bot/commits{/sha}","git_commits_url":"https://api.github.com/repos/netguru/bob-the-bot/git/commits{/sha}","comments_url":"https://api.github.com/repos/netguru/bob-the-bot/comments{/number}","issue_comment_url":"https://api.github.com/repos/netguru/bob-the-bot/issues/comments{/number}","contents_url":"https://api.github.com/repos/netguru/bob-the-bot/contents/{+path}","compare_url":"https://api.github.com/repos/netguru/bob-the-bot/compare/{base}...{head}","merges_url":"https://api.github.com/repos/netguru/bob-the-bot/merges","archive_url":"https://api.github.com/repos/netguru/bob-the-bot/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/netguru/bob-the-bot/downloads","issues_url":"https://api.github.com/repos/netguru/bob-the-bot/issues{/number}","pulls_url":"https://api.github.com/repos/netguru/bob-the-bot/pulls{/number}","milestones_url":"https://api.github.com/repos/netguru/bob-the-bot/milestones{/number}","notifications_url":"https://api.github.com/repos/netguru/bob-the-bot/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/netguru/bob-the-bot/labels{/name}","releases_url":"https://api.github.com/repos/netguru/bob-the-bot/releases{/id}","deployments_url":"https://api.github.com/repos/netguru/bob-the-bot/deployments","created_at":"2018-07-17T07:35:10Z","updated_at":"2018-08-23T08:52:24Z","pushed_at":"2018-08-23T09:15:55Z","git_url":"git://github.com/netguru/bob-the-bot.git","ssh_url":"git@github.com:netguru/bob-the-bot.git","clone_url":"https://github.com/netguru/bob-the-bot.git","svn_url":"https://github.com/netguru/bob-the-bot","homepage":null,"size":151,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":4,"license":null,"forks":0,"open_issues":4,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/netguru/bob-the-bot/pulls/23"},"html":{"href":"https://github.com/netguru/bob-the-bot/pull/23"},"issue":{"href":"https://api.github.com/repos/netguru/bob-the-bot/issues/23"},"comments":{"href":"https://api.github.com/repos/netguru/bob-the-bot/issues/23/comments"},"review_comments":{"href":"https://api.github.com/repos/netguru/bob-the-bot/pulls/23/comments"},"review_comment":{"href":"https://api.github.com/repos/netguru/bob-the-bot/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/netguru/bob-the-bot/pulls/23/commits"},"statuses":{"href":"https://api.github.com/repos/netguru/bob-the-bot/statuses/fb1076323562b394dc26f05816efc278f112c0da"}},"author_association":"NONE"}}
{"actor":{"display_login":"codeclimate"}}