{"action":"created","comment":{"url":"https://api.github.com/repos/HackGT/botgt/pulls/comments/172065809","pull_request_review_id":101020582,"id":172065809,"diff_hunk":"@@ -0,0 +1,78 @@\n+# Description:\n+#   Notifications for botgt\n+# Commands:\n+#   hubot notify <message> - notify everyone with something\n+#   hubot notify #channel1 ... #channeln !medium1 ... !mediumn <message>  - notify certain channels with something channels and mediums are optional but order matters (do not mix channels and mediums)\n+# Author:\n+#   Jacob Zipper\n+\n+request = require \"request-promise\"\n+adminKey = (Buffer.from process.env.BUZZER_ADMIN_KEY_SECRET).toString 'base64'\n+options = {\n+  uri: 'https://buzzer.hack.gt/graphql',\n+  qs: {\n+    query: '',\n+    variables: ''\n+  },\n+  headers: {\n+    'Authorization': 'Basic ' + adminKey\n+  },\n+  json: true\n+}\n+\n+module.exports = (robot) ->\n+  robot.respond /notify (.*)/i, (res) ->\n+    tokens = res.match[1].split \" \"\n+    mediums = []\n+    vars = {\n+      msg: [],\n+      plugins: {}\n+    }\n+    varsTemp = {\n+      twitter: {},\n+      facebook: {},\n+      slack: {\n+        channels: [],\n+      },\n+      live_site: {}\n+    }\n+    query = \"\"\"\n+    query ($msg: String!, $plugins: PluginMaster!) {\n+      send_message(message: $msg, plugins: $plugins) {\n+        plugin\n+        errors {\n+          error\n+          key\n+          message\n+        }\n+      }\n+    }\n+    \"\"\"\n+    foundChannels = false\n+    foundMediums = false\n+    for i in [0 ... tokens.length]\n+      if !foundChannels\n+        if tokens[i][0] == \"#\"\n+          varsTemp.slack.channels.push tokens[i].substr 1\n+        else\n+          foundChannels = true\n+      if foundChannels\n+        if !foundMediums\n+          if tokens[i][0] == \"!\"\n+            mediums.push tokens[i].substr 1\n+          else\n+            foundMediums = true\n+      if foundChannels && foundMediums\n+        vars.msg.push tokens[i]\n+      i++\n+    vars.msg = vars.msg.join \" \"\n+    for medium in mediums\n+      vars.plugins[medium] = varsTemp[medium]\n+    options.qs.query = query\n+    options.qs.variables = JSON.stringify vars\n+    console.log JSON.stringify vars\n+    request options\n+    .then (ret) ->\n+      res.reply \"Your notification has sent! Here's some debug output.\\n\\n\" + JSON.stringify ret","path":"scripts/notifications.coffee","position":76,"original_position":76,"commit_id":"0f5b195f1cbe2a0ec18c18a1e3edbe7393d4e8f4","original_commit_id":"0f5b195f1cbe2a0ec18c18a1e3edbe7393d4e8f4","user":{"login":"illegalprime","id":4401220,"avatar_url":"https://avatars3.githubusercontent.com/u/4401220?v=4","gravatar_id":"","url":"https://api.github.com/users/illegalprime","html_url":"https://github.com/illegalprime","followers_url":"https://api.github.com/users/illegalprime/followers","following_url":"https://api.github.com/users/illegalprime/following{/other_user}","gists_url":"https://api.github.com/users/illegalprime/gists{/gist_id}","starred_url":"https://api.github.com/users/illegalprime/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/illegalprime/subscriptions","organizations_url":"https://api.github.com/users/illegalprime/orgs","repos_url":"https://api.github.com/users/illegalprime/repos","events_url":"https://api.github.com/users/illegalprime/events{/privacy}","received_events_url":"https://api.github.com/users/illegalprime/received_events","type":"User","site_admin":false},"body":"Can you parse the return object and log exactly which notifications succeeded and which did not?\r\nJust because sending the graphql request succeeded doesn't mean there are no errors returned (it might have completed correctly but logged some errors to return).","created_at":"2018-03-04T21:43:12Z","updated_at":"2018-03-04T21:46:56Z","html_url":"https://github.com/HackGT/botgt/pull/1#discussion_r172065809","pull_request_url":"https://api.github.com/repos/HackGT/botgt/pulls/1","author_association":"OWNER","_links":{"self":{"href":"https://api.github.com/repos/HackGT/botgt/pulls/comments/172065809"},"html":{"href":"https://github.com/HackGT/botgt/pull/1#discussion_r172065809"},"pull_request":{"href":"https://api.github.com/repos/HackGT/botgt/pulls/1"}}},"pull_request":{"url":"https://api.github.com/repos/HackGT/botgt/pulls/1","id":172710642,"html_url":"https://github.com/HackGT/botgt/pull/1","diff_url":"https://github.com/HackGT/botgt/pull/1.diff","patch_url":"https://github.com/HackGT/botgt/pull/1.patch","issue_url":"https://api.github.com/repos/HackGT/botgt/issues/1","number":1,"state":"open","locked":false,"title":"Notifications","user":{"login":"jacobzipper","id":17678313,"avatar_url":"https://avatars3.githubusercontent.com/u/17678313?v=4","gravatar_id":"","url":"https://api.github.com/users/jacobzipper","html_url":"https://github.com/jacobzipper","followers_url":"https://api.github.com/users/jacobzipper/followers","following_url":"https://api.github.com/users/jacobzipper/following{/other_user}","gists_url":"https://api.github.com/users/jacobzipper/gists{/gist_id}","starred_url":"https://api.github.com/users/jacobzipper/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jacobzipper/subscriptions","organizations_url":"https://api.github.com/users/jacobzipper/orgs","repos_url":"https://api.github.com/users/jacobzipper/repos","events_url":"https://api.github.com/users/jacobzipper/events{/privacy}","received_events_url":"https://api.github.com/users/jacobzipper/received_events","type":"User","site_admin":false},"body":"CoffeeScript plugin for botgt that allows interaction with the buzzer server.\r\n\r\nMake sure to set BUZZER_ADMIN_KEY_SECRET when deployed :+1: ","created_at":"2018-03-04T09:28:33Z","updated_at":"2018-03-04T21:46:56Z","closed_at":null,"merged_at":null,"merge_commit_sha":"1e0897e5dcb990aa5823ea6d1c5f953488eac295","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/HackGT/botgt/pulls/1/commits","review_comments_url":"https://api.github.com/repos/HackGT/botgt/pulls/1/comments","review_comment_url":"https://api.github.com/repos/HackGT/botgt/pulls/comments{/number}","comments_url":"https://api.github.com/repos/HackGT/botgt/issues/1/comments","statuses_url":"https://api.github.com/repos/HackGT/botgt/statuses/0f5b195f1cbe2a0ec18c18a1e3edbe7393d4e8f4","head":{"label":"HackGT:notifications","ref":"notifications","sha":"0f5b195f1cbe2a0ec18c18a1e3edbe7393d4e8f4","user":{"login":"HackGT","id":10822553,"avatar_url":"https://avatars0.githubusercontent.com/u/10822553?v=4","gravatar_id":"","url":"https://api.github.com/users/HackGT","html_url":"https://github.com/HackGT","followers_url":"https://api.github.com/users/HackGT/followers","following_url":"https://api.github.com/users/HackGT/following{/other_user}","gists_url":"https://api.github.com/users/HackGT/gists{/gist_id}","starred_url":"https://api.github.com/users/HackGT/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/HackGT/subscriptions","organizations_url":"https://api.github.com/users/HackGT/orgs","repos_url":"https://api.github.com/users/HackGT/repos","events_url":"https://api.github.com/users/HackGT/events{/privacy}","received_events_url":"https://api.github.com/users/HackGT/received_events","type":"Organization","site_admin":false},"repo":{"id":79845789,"name":"botgt","full_name":"HackGT/botgt","owner":{"login":"HackGT","id":10822553,"avatar_url":"https://avatars0.githubusercontent.com/u/10822553?v=4","gravatar_id":"","url":"https://api.github.com/users/HackGT","html_url":"https://github.com/HackGT","followers_url":"https://api.github.com/users/HackGT/followers","following_url":"https://api.github.com/users/HackGT/following{/other_user}","gists_url":"https://api.github.com/users/HackGT/gists{/gist_id}","starred_url":"https://api.github.com/users/HackGT/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/HackGT/subscriptions","organizations_url":"https://api.github.com/users/HackGT/orgs","repos_url":"https://api.github.com/users/HackGT/repos","events_url":"https://api.github.com/users/HackGT/events{/privacy}","received_events_url":"https://api.github.com/users/HackGT/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/HackGT/botgt","description":"HackGT's Hubot configuration","fork":false,"url":"https://api.github.com/repos/HackGT/botgt","forks_url":"https://api.github.com/repos/HackGT/botgt/forks","keys_url":"https://api.github.com/repos/HackGT/botgt/keys{/key_id}","collaborators_url":"https://api.github.com/repos/HackGT/botgt/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/HackGT/botgt/teams","hooks_url":"https://api.github.com/repos/HackGT/botgt/hooks","issue_events_url":"https://api.github.com/repos/HackGT/botgt/issues/events{/number}","events_url":"https://api.github.com/repos/HackGT/botgt/events","assignees_url":"https://api.github.com/repos/HackGT/botgt/assignees{/user}","branches_url":"https://api.github.com/repos/HackGT/botgt/branches{/branch}","tags_url":"https://api.github.com/repos/HackGT/botgt/tags","blobs_url":"https://api.github.com/repos/HackGT/botgt/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/HackGT/botgt/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/HackGT/botgt/git/refs{/sha}","trees_url":"https://api.github.com/repos/HackGT/botgt/git/trees{/sha}","statuses_url":"https://api.github.com/repos/HackGT/botgt/statuses/{sha}","languages_url":"https://api.github.com/repos/HackGT/botgt/languages","stargazers_url":"https://api.github.com/repos/HackGT/botgt/stargazers","contributors_url":"https://api.github.com/repos/HackGT/botgt/contributors","subscribers_url":"https://api.github.com/repos/HackGT/botgt/subscribers","subscription_url":"https://api.github.com/repos/HackGT/botgt/subscription","commits_url":"https://api.github.com/repos/HackGT/botgt/commits{/sha}","git_commits_url":"https://api.github.com/repos/HackGT/botgt/git/commits{/sha}","comments_url":"https://api.github.com/repos/HackGT/botgt/comments{/number}","issue_comment_url":"https://api.github.com/repos/HackGT/botgt/issues/comments{/number}","contents_url":"https://api.github.com/repos/HackGT/botgt/contents/{+path}","compare_url":"https://api.github.com/repos/HackGT/botgt/compare/{base}...{head}","merges_url":"https://api.github.com/repos/HackGT/botgt/merges","archive_url":"https://api.github.com/repos/HackGT/botgt/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/HackGT/botgt/downloads","issues_url":"https://api.github.com/repos/HackGT/botgt/issues{/number}","pulls_url":"https://api.github.com/repos/HackGT/botgt/pulls{/number}","milestones_url":"https://api.github.com/repos/HackGT/botgt/milestones{/number}","notifications_url":"https://api.github.com/repos/HackGT/botgt/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/HackGT/botgt/labels{/name}","releases_url":"https://api.github.com/repos/HackGT/botgt/releases{/id}","deployments_url":"https://api.github.com/repos/HackGT/botgt/deployments","created_at":"2017-01-23T20:40:43Z","updated_at":"2017-12-27T18:22:10Z","pushed_at":"2018-03-04T18:41:20Z","git_url":"git://github.com/HackGT/botgt.git","ssh_url":"git@github.com:HackGT/botgt.git","clone_url":"https://github.com/HackGT/botgt.git","svn_url":"https://github.com/HackGT/botgt","homepage":null,"size":67,"stargazers_count":0,"watchers_count":0,"language":"Shell","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":1,"license":{"key":"gpl-3.0","name":"GNU General Public License v3.0","spdx_id":"GPL-3.0","url":"https://api.github.com/licenses/gpl-3.0"},"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"base":{"label":"HackGT:master","ref":"master","sha":"eb3117698a72d5af80ac768faba2a3420e2ec8b4","user":{"login":"HackGT","id":10822553,"avatar_url":"https://avatars0.githubusercontent.com/u/10822553?v=4","gravatar_id":"","url":"https://api.github.com/users/HackGT","html_url":"https://github.com/HackGT","followers_url":"https://api.github.com/users/HackGT/followers","following_url":"https://api.github.com/users/HackGT/following{/other_user}","gists_url":"https://api.github.com/users/HackGT/gists{/gist_id}","starred_url":"https://api.github.com/users/HackGT/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/HackGT/subscriptions","organizations_url":"https://api.github.com/users/HackGT/orgs","repos_url":"https://api.github.com/users/HackGT/repos","events_url":"https://api.github.com/users/HackGT/events{/privacy}","received_events_url":"https://api.github.com/users/HackGT/received_events","type":"Organization","site_admin":false},"repo":{"id":79845789,"name":"botgt","full_name":"HackGT/botgt","owner":{"login":"HackGT","id":10822553,"avatar_url":"https://avatars0.githubusercontent.com/u/10822553?v=4","gravatar_id":"","url":"https://api.github.com/users/HackGT","html_url":"https://github.com/HackGT","followers_url":"https://api.github.com/users/HackGT/followers","following_url":"https://api.github.com/users/HackGT/following{/other_user}","gists_url":"https://api.github.com/users/HackGT/gists{/gist_id}","starred_url":"https://api.github.com/users/HackGT/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/HackGT/subscriptions","organizations_url":"https://api.github.com/users/HackGT/orgs","repos_url":"https://api.github.com/users/HackGT/repos","events_url":"https://api.github.com/users/HackGT/events{/privacy}","received_events_url":"https://api.github.com/users/HackGT/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/HackGT/botgt","description":"HackGT's Hubot configuration","fork":false,"url":"https://api.github.com/repos/HackGT/botgt","forks_url":"https://api.github.com/repos/HackGT/botgt/forks","keys_url":"https://api.github.com/repos/HackGT/botgt/keys{/key_id}","collaborators_url":"https://api.github.com/repos/HackGT/botgt/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/HackGT/botgt/teams","hooks_url":"https://api.github.com/repos/HackGT/botgt/hooks","issue_events_url":"https://api.github.com/repos/HackGT/botgt/issues/events{/number}","events_url":"https://api.github.com/repos/HackGT/botgt/events","assignees_url":"https://api.github.com/repos/HackGT/botgt/assignees{/user}","branches_url":"https://api.github.com/repos/HackGT/botgt/branches{/branch}","tags_url":"https://api.github.com/repos/HackGT/botgt/tags","blobs_url":"https://api.github.com/repos/HackGT/botgt/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/HackGT/botgt/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/HackGT/botgt/git/refs{/sha}","trees_url":"https://api.github.com/repos/HackGT/botgt/git/trees{/sha}","statuses_url":"https://api.github.com/repos/HackGT/botgt/statuses/{sha}","languages_url":"https://api.github.com/repos/HackGT/botgt/languages","stargazers_url":"https://api.github.com/repos/HackGT/botgt/stargazers","contributors_url":"https://api.github.com/repos/HackGT/botgt/contributors","subscribers_url":"https://api.github.com/repos/HackGT/botgt/subscribers","subscription_url":"https://api.github.com/repos/HackGT/botgt/subscription","commits_url":"https://api.github.com/repos/HackGT/botgt/commits{/sha}","git_commits_url":"https://api.github.com/repos/HackGT/botgt/git/commits{/sha}","comments_url":"https://api.github.com/repos/HackGT/botgt/comments{/number}","issue_comment_url":"https://api.github.com/repos/HackGT/botgt/issues/comments{/number}","contents_url":"https://api.github.com/repos/HackGT/botgt/contents/{+path}","compare_url":"https://api.github.com/repos/HackGT/botgt/compare/{base}...{head}","merges_url":"https://api.github.com/repos/HackGT/botgt/merges","archive_url":"https://api.github.com/repos/HackGT/botgt/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/HackGT/botgt/downloads","issues_url":"https://api.github.com/repos/HackGT/botgt/issues{/number}","pulls_url":"https://api.github.com/repos/HackGT/botgt/pulls{/number}","milestones_url":"https://api.github.com/repos/HackGT/botgt/milestones{/number}","notifications_url":"https://api.github.com/repos/HackGT/botgt/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/HackGT/botgt/labels{/name}","releases_url":"https://api.github.com/repos/HackGT/botgt/releases{/id}","deployments_url":"https://api.github.com/repos/HackGT/botgt/deployments","created_at":"2017-01-23T20:40:43Z","updated_at":"2017-12-27T18:22:10Z","pushed_at":"2018-03-04T18:41:20Z","git_url":"git://github.com/HackGT/botgt.git","ssh_url":"git@github.com:HackGT/botgt.git","clone_url":"https://github.com/HackGT/botgt.git","svn_url":"https://github.com/HackGT/botgt","homepage":null,"size":67,"stargazers_count":0,"watchers_count":0,"language":"Shell","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":1,"license":{"key":"gpl-3.0","name":"GNU General Public License v3.0","spdx_id":"GPL-3.0","url":"https://api.github.com/licenses/gpl-3.0"},"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/HackGT/botgt/pulls/1"},"html":{"href":"https://github.com/HackGT/botgt/pull/1"},"issue":{"href":"https://api.github.com/repos/HackGT/botgt/issues/1"},"comments":{"href":"https://api.github.com/repos/HackGT/botgt/issues/1/comments"},"review_comments":{"href":"https://api.github.com/repos/HackGT/botgt/pulls/1/comments"},"review_comment":{"href":"https://api.github.com/repos/HackGT/botgt/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/HackGT/botgt/pulls/1/commits"},"statuses":{"href":"https://api.github.com/repos/HackGT/botgt/statuses/0f5b195f1cbe2a0ec18c18a1e3edbe7393d4e8f4"}},"author_association":"NONE"}}
{"actor":{"display_login":"illegalprime"}}