{"action":"created","comment":{"url":"https://api.github.com/repos/concierge/Concierge/pulls/comments/89070883","pull_request_review_id":9620917,"id":89070883,"diff_hunk":"@@ -0,0 +1,93 @@\n+﻿const fs = require('fs'),\n+    path = require('path'),\n+    urlMatcher = /^(?:\\w+:)?\\/\\/([^\\s\\.]+\\.\\S{2}|localhost[\\:?\\d]*)\\S*$/,\n+    imageExts = ['.jpg', '.png', '.gif', '.gifv', '.tif', '.tiff', '.jpeg'];\n+\n+class Message {\n+    constructor(event, prefix) {\n+        this.event = event;\n+        this.prefix = prefix;\n+\n+        this.room = event.thread_id;\n+        this.text = event.body;\n+        this.user = {\n+            name: event.sender_name,\n+            id: event.sender_id,\n+            email_address: `${event.sender_name}@unknown.com`\n+        };\n+    }\n+}\n+\n+class Responder {\n+    constructor(api, event, match, message) {\n+        this.api = api;\n+        this.event = event;\n+        this.match = match;\n+        this.message = message;\n+        this.envelope = message;\n+    }\n+\n+    random(arr) {\n+        return this.api.random(arr);\n+    }\n+\n+    static _getType(message) {\n+        try {\n+            fs.statSync(message);\n+            return 'file';\n+        }\n+        catch (e) { }\n+\n+        if (!urlMatcher.test(message)) {\n+            return 'message';\n+        }\n+\n+        const ext = path.extname(message);\n+        if (imageExts.includes(ext)) {\n+            return 'image';\n+        }\n+        return 'url';\n+    }\n+\n+    _internalSend(threadId, data) {\n+        for (let i = 0; i < data.length; i++) {\n+            switch (Responder._getType(data[i])) {\n+                case 'message':\n+                    this.api.sendMessage(data[i], threadId);\n+                    break;\n+                case 'url':","path":"core/modules/hubot/hubotUtils.js","position":58,"original_position":58,"commit_id":"8b2225320d2c303b2b9e582f7822d7a536c1a1b9","original_commit_id":"8b2225320d2c303b2b9e582f7822d7a536c1a1b9","user":{"login":"codacy-bot","id":19940114,"avatar_url":"https://avatars.githubusercontent.com/u/19940114?v=3","gravatar_id":"","url":"https://api.github.com/users/codacy-bot","html_url":"https://github.com/codacy-bot","followers_url":"https://api.github.com/users/codacy-bot/followers","following_url":"https://api.github.com/users/codacy-bot/following{/other_user}","gists_url":"https://api.github.com/users/codacy-bot/gists{/gist_id}","starred_url":"https://api.github.com/users/codacy-bot/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/codacy-bot/subscriptions","organizations_url":"https://api.github.com/users/codacy-bot/orgs","repos_url":"https://api.github.com/users/codacy-bot/repos","events_url":"https://api.github.com/users/codacy-bot/events{/privacy}","received_events_url":"https://api.github.com/users/codacy-bot/received_events","type":"User","site_admin":false},"body":"![Codacy](https://www.codacy.com/assets/images/favicon.png) Issue found: [Expected indentation of 12 spaces but found 16. (indent)](https://www.codacy.com/app/Concierge/Concierge/file/4489691901/issues/source?bid=3282987&fileBranchId=3823006#l58)","created_at":"2016-11-22T09:18:39Z","updated_at":"2016-11-22T09:18:39Z","html_url":"https://github.com/concierge/Concierge/pull/224#discussion_r89070883","pull_request_url":"https://api.github.com/repos/concierge/Concierge/pulls/224","_links":{"self":{"href":"https://api.github.com/repos/concierge/Concierge/pulls/comments/89070883"},"html":{"href":"https://github.com/concierge/Concierge/pull/224#discussion_r89070883"},"pull_request":{"href":"https://api.github.com/repos/concierge/Concierge/pulls/224"}}},"pull_request":{"url":"https://api.github.com/repos/concierge/Concierge/pulls/224","id":90132999,"html_url":"https://github.com/concierge/Concierge/pull/224","diff_url":"https://github.com/concierge/Concierge/pull/224.diff","patch_url":"https://github.com/concierge/Concierge/pull/224.patch","issue_url":"https://api.github.com/repos/concierge/Concierge/issues/224","number":224,"state":"open","locked":false,"title":"4.0 beta","user":{"login":"mrkno","id":6830312,"avatar_url":"https://avatars.githubusercontent.com/u/6830312?v=3","gravatar_id":"","url":"https://api.github.com/users/mrkno","html_url":"https://github.com/mrkno","followers_url":"https://api.github.com/users/mrkno/followers","following_url":"https://api.github.com/users/mrkno/following{/other_user}","gists_url":"https://api.github.com/users/mrkno/gists{/gist_id}","starred_url":"https://api.github.com/users/mrkno/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mrkno/subscriptions","organizations_url":"https://api.github.com/users/mrkno/orgs","repos_url":"https://api.github.com/users/mrkno/repos","events_url":"https://api.github.com/users/mrkno/events{/privacy}","received_events_url":"https://api.github.com/users/mrkno/received_events","type":"User","site_admin":false},"body":"Resolves #217, resolves #210 (via middleware)\r\n\r\nTodo:\r\n- ~~Allow integrations to be installed, uninstalled and configured at runtime~~\r\n- ~~Allow modules to be 'services' (that is, no I/O, only start/stop)~~\r\n- ~~Add onload/unload module events - all ES6 code should extend EventEmitter so we get events by default.~~\r\n- ~~Allow I/O interception (middleware). Also useful for services.~~\r\n- ~~Gracefully handle non-existent integrations~~\r\n- ~~Fix help~~ https://github.com/concierge/help/pull/1\r\n- ~~Fix admin~~ https://github.com/concierge/admin/pull/1\r\n- ~~Fix disable~~ https://github.com/concierge/disable/pull/1\r\n- ~~Fix lolphp~~ https://github.com/concierge/lolphp/pull/1\r\n- ~~Fix programmer~~ https://github.com/concierge/programmer/pull/1\r\n- ~~Fix pickup~~ https://github.com/concierge/pickup/pull/1\r\n- ~~Fix joke~~ https://github.com/concierge/joke/pull/1\r\n- ~~Fix insult~~ https://github.com/concierge/insult/pull/1\r\n- ~~Fix quote~~ https://github.com/concierge/quote/commit/8a695888dea157964cfc6a2d25eb20811861a0a6\r\n- ~~Fix update~~ https://github.com/concierge/update/pull/1\r\n- ~~Update KPM~~ https://github.com/concierge/kpm/pull/6\r\n- ~~Documentation updates~~\r\n- ~~Module unloading infinite loop when a failure occurs~~\r\n- ~~Config as an unloadable/overrideable service~~\r\n- Integration config migration \r\n\r\nWishlist:\r\n- ~~Async module loading~~ deferred to 4.1\r\n  - ~~Decoupled GUI~~\r\n  - ~~Async loading calls~~\r\n- ~~Prevent Facebook crashes from bringing down Concierge~~\r\n- ~~Implement means to blame a module for being the source of an exception~~\r\n\r\nFixed:\r\n- Local files that could not be resolved would be installed via NPM\r\n- Loopback would not work unless using ES6 style integrations\r\n","created_at":"2016-10-20T04:49:57Z","updated_at":"2016-11-22T09:18:39Z","closed_at":null,"merged_at":null,"merge_commit_sha":"c2d57a5ad38131632b5e81a257621db3ff16ca1f","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/concierge/Concierge/pulls/224/commits","review_comments_url":"https://api.github.com/repos/concierge/Concierge/pulls/224/comments","review_comment_url":"https://api.github.com/repos/concierge/Concierge/pulls/comments{/number}","comments_url":"https://api.github.com/repos/concierge/Concierge/issues/224/comments","statuses_url":"https://api.github.com/repos/concierge/Concierge/statuses/8b2225320d2c303b2b9e582f7822d7a536c1a1b9","head":{"label":"concierge:4.0-beta.0.1","ref":"4.0-beta.0.1","sha":"8b2225320d2c303b2b9e582f7822d7a536c1a1b9","user":{"login":"concierge","id":18560428,"avatar_url":"https://avatars.githubusercontent.com/u/18560428?v=3","gravatar_id":"","url":"https://api.github.com/users/concierge","html_url":"https://github.com/concierge","followers_url":"https://api.github.com/users/concierge/followers","following_url":"https://api.github.com/users/concierge/following{/other_user}","gists_url":"https://api.github.com/users/concierge/gists{/gist_id}","starred_url":"https://api.github.com/users/concierge/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/concierge/subscriptions","organizations_url":"https://api.github.com/users/concierge/orgs","repos_url":"https://api.github.com/users/concierge/repos","events_url":"https://api.github.com/users/concierge/events{/privacy}","received_events_url":"https://api.github.com/users/concierge/received_events","type":"Organization","site_admin":false},"repo":{"id":39051419,"name":"Concierge","full_name":"concierge/Concierge","owner":{"login":"concierge","id":18560428,"avatar_url":"https://avatars.githubusercontent.com/u/18560428?v=3","gravatar_id":"","url":"https://api.github.com/users/concierge","html_url":"https://github.com/concierge","followers_url":"https://api.github.com/users/concierge/followers","following_url":"https://api.github.com/users/concierge/following{/other_user}","gists_url":"https://api.github.com/users/concierge/gists{/gist_id}","starred_url":"https://api.github.com/users/concierge/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/concierge/subscriptions","organizations_url":"https://api.github.com/users/concierge/orgs","repos_url":"https://api.github.com/users/concierge/repos","events_url":"https://api.github.com/users/concierge/events{/privacy}","received_events_url":"https://api.github.com/users/concierge/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/concierge/Concierge","description":"Modular chat bot. (Karma + Sassy) * (Facebook + Slack) - Hipchat = Kassy","fork":false,"url":"https://api.github.com/repos/concierge/Concierge","forks_url":"https://api.github.com/repos/concierge/Concierge/forks","keys_url":"https://api.github.com/repos/concierge/Concierge/keys{/key_id}","collaborators_url":"https://api.github.com/repos/concierge/Concierge/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/concierge/Concierge/teams","hooks_url":"https://api.github.com/repos/concierge/Concierge/hooks","issue_events_url":"https://api.github.com/repos/concierge/Concierge/issues/events{/number}","events_url":"https://api.github.com/repos/concierge/Concierge/events","assignees_url":"https://api.github.com/repos/concierge/Concierge/assignees{/user}","branches_url":"https://api.github.com/repos/concierge/Concierge/branches{/branch}","tags_url":"https://api.github.com/repos/concierge/Concierge/tags","blobs_url":"https://api.github.com/repos/concierge/Concierge/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/concierge/Concierge/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/concierge/Concierge/git/refs{/sha}","trees_url":"https://api.github.com/repos/concierge/Concierge/git/trees{/sha}","statuses_url":"https://api.github.com/repos/concierge/Concierge/statuses/{sha}","languages_url":"https://api.github.com/repos/concierge/Concierge/languages","stargazers_url":"https://api.github.com/repos/concierge/Concierge/stargazers","contributors_url":"https://api.github.com/repos/concierge/Concierge/contributors","subscribers_url":"https://api.github.com/repos/concierge/Concierge/subscribers","subscription_url":"https://api.github.com/repos/concierge/Concierge/subscription","commits_url":"https://api.github.com/repos/concierge/Concierge/commits{/sha}","git_commits_url":"https://api.github.com/repos/concierge/Concierge/git/commits{/sha}","comments_url":"https://api.github.com/repos/concierge/Concierge/comments{/number}","issue_comment_url":"https://api.github.com/repos/concierge/Concierge/issues/comments{/number}","contents_url":"https://api.github.com/repos/concierge/Concierge/contents/{+path}","compare_url":"https://api.github.com/repos/concierge/Concierge/compare/{base}...{head}","merges_url":"https://api.github.com/repos/concierge/Concierge/merges","archive_url":"https://api.github.com/repos/concierge/Concierge/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/concierge/Concierge/downloads","issues_url":"https://api.github.com/repos/concierge/Concierge/issues{/number}","pulls_url":"https://api.github.com/repos/concierge/Concierge/pulls{/number}","milestones_url":"https://api.github.com/repos/concierge/Concierge/milestones{/number}","notifications_url":"https://api.github.com/repos/concierge/Concierge/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/concierge/Concierge/labels{/name}","releases_url":"https://api.github.com/repos/concierge/Concierge/releases{/id}","deployments_url":"https://api.github.com/repos/concierge/Concierge/deployments","created_at":"2015-07-14T03:27:54Z","updated_at":"2016-11-15T18:04:46Z","pushed_at":"2016-11-22T09:16:58Z","git_url":"git://github.com/concierge/Concierge.git","ssh_url":"git@github.com:concierge/Concierge.git","clone_url":"https://github.com/concierge/Concierge.git","svn_url":"https://github.com/concierge/Concierge","homepage":"","size":5129,"stargazers_count":70,"watchers_count":70,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":23,"mirror_url":null,"open_issues_count":10,"forks":23,"open_issues":10,"watchers":70,"default_branch":"master"}},"base":{"label":"concierge:master","ref":"master","sha":"458923c47dba233ea6bce7ac3e4c240bdc609cc3","user":{"login":"concierge","id":18560428,"avatar_url":"https://avatars.githubusercontent.com/u/18560428?v=3","gravatar_id":"","url":"https://api.github.com/users/concierge","html_url":"https://github.com/concierge","followers_url":"https://api.github.com/users/concierge/followers","following_url":"https://api.github.com/users/concierge/following{/other_user}","gists_url":"https://api.github.com/users/concierge/gists{/gist_id}","starred_url":"https://api.github.com/users/concierge/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/concierge/subscriptions","organizations_url":"https://api.github.com/users/concierge/orgs","repos_url":"https://api.github.com/users/concierge/repos","events_url":"https://api.github.com/users/concierge/events{/privacy}","received_events_url":"https://api.github.com/users/concierge/received_events","type":"Organization","site_admin":false},"repo":{"id":39051419,"name":"Concierge","full_name":"concierge/Concierge","owner":{"login":"concierge","id":18560428,"avatar_url":"https://avatars.githubusercontent.com/u/18560428?v=3","gravatar_id":"","url":"https://api.github.com/users/concierge","html_url":"https://github.com/concierge","followers_url":"https://api.github.com/users/concierge/followers","following_url":"https://api.github.com/users/concierge/following{/other_user}","gists_url":"https://api.github.com/users/concierge/gists{/gist_id}","starred_url":"https://api.github.com/users/concierge/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/concierge/subscriptions","organizations_url":"https://api.github.com/users/concierge/orgs","repos_url":"https://api.github.com/users/concierge/repos","events_url":"https://api.github.com/users/concierge/events{/privacy}","received_events_url":"https://api.github.com/users/concierge/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/concierge/Concierge","description":"Modular chat bot. (Karma + Sassy) * (Facebook + Slack) - Hipchat = Kassy","fork":false,"url":"https://api.github.com/repos/concierge/Concierge","forks_url":"https://api.github.com/repos/concierge/Concierge/forks","keys_url":"https://api.github.com/repos/concierge/Concierge/keys{/key_id}","collaborators_url":"https://api.github.com/repos/concierge/Concierge/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/concierge/Concierge/teams","hooks_url":"https://api.github.com/repos/concierge/Concierge/hooks","issue_events_url":"https://api.github.com/repos/concierge/Concierge/issues/events{/number}","events_url":"https://api.github.com/repos/concierge/Concierge/events","assignees_url":"https://api.github.com/repos/concierge/Concierge/assignees{/user}","branches_url":"https://api.github.com/repos/concierge/Concierge/branches{/branch}","tags_url":"https://api.github.com/repos/concierge/Concierge/tags","blobs_url":"https://api.github.com/repos/concierge/Concierge/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/concierge/Concierge/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/concierge/Concierge/git/refs{/sha}","trees_url":"https://api.github.com/repos/concierge/Concierge/git/trees{/sha}","statuses_url":"https://api.github.com/repos/concierge/Concierge/statuses/{sha}","languages_url":"https://api.github.com/repos/concierge/Concierge/languages","stargazers_url":"https://api.github.com/repos/concierge/Concierge/stargazers","contributors_url":"https://api.github.com/repos/concierge/Concierge/contributors","subscribers_url":"https://api.github.com/repos/concierge/Concierge/subscribers","subscription_url":"https://api.github.com/repos/concierge/Concierge/subscription","commits_url":"https://api.github.com/repos/concierge/Concierge/commits{/sha}","git_commits_url":"https://api.github.com/repos/concierge/Concierge/git/commits{/sha}","comments_url":"https://api.github.com/repos/concierge/Concierge/comments{/number}","issue_comment_url":"https://api.github.com/repos/concierge/Concierge/issues/comments{/number}","contents_url":"https://api.github.com/repos/concierge/Concierge/contents/{+path}","compare_url":"https://api.github.com/repos/concierge/Concierge/compare/{base}...{head}","merges_url":"https://api.github.com/repos/concierge/Concierge/merges","archive_url":"https://api.github.com/repos/concierge/Concierge/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/concierge/Concierge/downloads","issues_url":"https://api.github.com/repos/concierge/Concierge/issues{/number}","pulls_url":"https://api.github.com/repos/concierge/Concierge/pulls{/number}","milestones_url":"https://api.github.com/repos/concierge/Concierge/milestones{/number}","notifications_url":"https://api.github.com/repos/concierge/Concierge/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/concierge/Concierge/labels{/name}","releases_url":"https://api.github.com/repos/concierge/Concierge/releases{/id}","deployments_url":"https://api.github.com/repos/concierge/Concierge/deployments","created_at":"2015-07-14T03:27:54Z","updated_at":"2016-11-15T18:04:46Z","pushed_at":"2016-11-22T09:16:58Z","git_url":"git://github.com/concierge/Concierge.git","ssh_url":"git@github.com:concierge/Concierge.git","clone_url":"https://github.com/concierge/Concierge.git","svn_url":"https://github.com/concierge/Concierge","homepage":"","size":5129,"stargazers_count":70,"watchers_count":70,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":23,"mirror_url":null,"open_issues_count":10,"forks":23,"open_issues":10,"watchers":70,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/concierge/Concierge/pulls/224"},"html":{"href":"https://github.com/concierge/Concierge/pull/224"},"issue":{"href":"https://api.github.com/repos/concierge/Concierge/issues/224"},"comments":{"href":"https://api.github.com/repos/concierge/Concierge/issues/224/comments"},"review_comments":{"href":"https://api.github.com/repos/concierge/Concierge/pulls/224/comments"},"review_comment":{"href":"https://api.github.com/repos/concierge/Concierge/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/concierge/Concierge/pulls/224/commits"},"statuses":{"href":"https://api.github.com/repos/concierge/Concierge/statuses/8b2225320d2c303b2b9e582f7822d7a536c1a1b9"}}}}
{"actor":{"display_login":"codacy-bot"}}