{"action":"created","comment":{"url":"https://api.github.com/repos/zulip/zulip/pulls/comments/92321311","pull_request_review_id":12833969,"id":92321311,"diff_hunk":"@@ -0,0 +1,149 @@\n+# See readme.md for instructions on running this code.\n+import requests\n+import json\n+import urllib2\n+        \n+\n+\n+\n+class IssueHandler(object):\n+    '''\n+    This plugin facilitates sending issues to github, when\n+    an item is prefixed with '@issue' or '@bug'\n+\n+    It will also write items to the issues stream, as well \n+    as reporting it to github\n+    '''\n+\n+    def usage(self):\n+        return '''\n+            This plugin will allow users to flag messages\n+            as being issues with Zulip by using te prefix '@issue'\n+            \n+            Before running this, make sure to create a stream\n+            called \"issues\" that your API user can send to.\n+            \n+            Also, make sure that the credentials of the github bot have\n+            been typed in correctly, that there is a personal access token\n+            with access to public repositories ONLY, \n+            and that the repository name is entered correctly.\n+            '''\n+\n+      \n+    \n+    def triage_message(self, message):\n+        # return True if we want to (possibly) respond to this message\n+\n+        original_content = message['content']\n+\n+        # This next line of code is defensive, as we\n+        # never want to get into an infinite loop of posting follow\n+        # ups for own follow ups!\n+        if message['display_recipient'] == 'issue':\n+            return False\n+        is_issue = (original_content.startswith('@issue'))\n+\n+        return is_issue\n+\n+    def handle_message(self, message, client, state_handler):\n+        original_content = message['content']\n+        original_sender = message['sender_email']\n+        \n+        print('sending issue')\n+        #gets token from google drive\n+        data = urllib2.urlopen(\"https://drive.google.com/uc?export=download&id=0Bwo9Sux-T0A9QVFKV2FGb1RxbnM\") #Downloads the file containing the token\n+        for line in data: # files are iterable\n+            print line\n+            PASSWORD = line\n+        # Authentication for user filing issue DOES NOT WORK IF\n+        # THE USER HAS READ/WRITE ACCESS TO THE REPOSITORY\n+        USERNAME = 'zulip-issue-bot'","path":"contrib_bots/lib/github_issues.py","position":60,"original_position":60,"commit_id":"e2cf111fcd420a78743166e885cd4f4f41f81624","original_commit_id":"e2cf111fcd420a78743166e885cd4f4f41f81624","user":{"login":"umairwaheed","id":641763,"avatar_url":"https://avatars.githubusercontent.com/u/641763?v=3","gravatar_id":"","url":"https://api.github.com/users/umairwaheed","html_url":"https://github.com/umairwaheed","followers_url":"https://api.github.com/users/umairwaheed/followers","following_url":"https://api.github.com/users/umairwaheed/following{/other_user}","gists_url":"https://api.github.com/users/umairwaheed/gists{/gist_id}","starred_url":"https://api.github.com/users/umairwaheed/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/umairwaheed/subscriptions","organizations_url":"https://api.github.com/users/umairwaheed/orgs","repos_url":"https://api.github.com/users/umairwaheed/repos","events_url":"https://api.github.com/users/umairwaheed/events{/privacy}","received_events_url":"https://api.github.com/users/umairwaheed/received_events","type":"User","site_admin":false},"body":"This should be added in the settings.","created_at":"2016-12-14T04:36:37Z","updated_at":"2016-12-14T04:36:37Z","html_url":"https://github.com/zulip/zulip/pull/2688#discussion_r92321311","pull_request_url":"https://api.github.com/repos/zulip/zulip/pulls/2688","_links":{"self":{"href":"https://api.github.com/repos/zulip/zulip/pulls/comments/92321311"},"html":{"href":"https://github.com/zulip/zulip/pull/2688#discussion_r92321311"},"pull_request":{"href":"https://api.github.com/repos/zulip/zulip/pulls/2688"}}},"pull_request":{"url":"https://api.github.com/repos/zulip/zulip/pulls/2688","id":97808739,"html_url":"https://github.com/zulip/zulip/pull/2688","diff_url":"https://github.com/zulip/zulip/pull/2688.diff","patch_url":"https://github.com/zulip/zulip/pull/2688.patch","issue_url":"https://api.github.com/repos/zulip/zulip/issues/2688","number":2688,"state":"open","locked":false,"title":"interactive bots: Create GitHub issue bot.","user":{"login":"fredfishgames","id":10870360,"avatar_url":"https://avatars.githubusercontent.com/u/10870360?v=3","gravatar_id":"","url":"https://api.github.com/users/fredfishgames","html_url":"https://github.com/fredfishgames","followers_url":"https://api.github.com/users/fredfishgames/followers","following_url":"https://api.github.com/users/fredfishgames/following{/other_user}","gists_url":"https://api.github.com/users/fredfishgames/gists{/gist_id}","starred_url":"https://api.github.com/users/fredfishgames/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fredfishgames/subscriptions","organizations_url":"https://api.github.com/users/fredfishgames/orgs","repos_url":"https://api.github.com/users/fredfishgames/repos","events_url":"https://api.github.com/users/fredfishgames/events{/privacy}","received_events_url":"https://api.github.com/users/fredfishgames/received_events","type":"User","site_admin":false},"body":"This bot uses a github account owned by me using an alternate email address. It will post to the fredfishgames/zulip repository at the moment, which can be found [here](https://github.com/fredfishgames/zulip/issues) It will also push issues to the issues stream, followed by a tick or a cross depending on whether it was succesfully sent to github.","created_at":"2016-12-13T18:32:47Z","updated_at":"2016-12-14T04:36:37Z","closed_at":null,"merged_at":null,"merge_commit_sha":"d610621fd5e46b2b4919a318b532bf8764cb6041","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/zulip/zulip/pulls/2688/commits","review_comments_url":"https://api.github.com/repos/zulip/zulip/pulls/2688/comments","review_comment_url":"https://api.github.com/repos/zulip/zulip/pulls/comments{/number}","comments_url":"https://api.github.com/repos/zulip/zulip/issues/2688/comments","statuses_url":"https://api.github.com/repos/zulip/zulip/statuses/e2cf111fcd420a78743166e885cd4f4f41f81624","head":{"label":"fredfishgames:task-github-issue-bot","ref":"task-github-issue-bot","sha":"e2cf111fcd420a78743166e885cd4f4f41f81624","user":{"login":"fredfishgames","id":10870360,"avatar_url":"https://avatars.githubusercontent.com/u/10870360?v=3","gravatar_id":"","url":"https://api.github.com/users/fredfishgames","html_url":"https://github.com/fredfishgames","followers_url":"https://api.github.com/users/fredfishgames/followers","following_url":"https://api.github.com/users/fredfishgames/following{/other_user}","gists_url":"https://api.github.com/users/fredfishgames/gists{/gist_id}","starred_url":"https://api.github.com/users/fredfishgames/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fredfishgames/subscriptions","organizations_url":"https://api.github.com/users/fredfishgames/orgs","repos_url":"https://api.github.com/users/fredfishgames/repos","events_url":"https://api.github.com/users/fredfishgames/events{/privacy}","received_events_url":"https://api.github.com/users/fredfishgames/received_events","type":"User","site_admin":false},"repo":{"id":76163744,"name":"zulip","full_name":"fredfishgames/zulip","owner":{"login":"fredfishgames","id":10870360,"avatar_url":"https://avatars.githubusercontent.com/u/10870360?v=3","gravatar_id":"","url":"https://api.github.com/users/fredfishgames","html_url":"https://github.com/fredfishgames","followers_url":"https://api.github.com/users/fredfishgames/followers","following_url":"https://api.github.com/users/fredfishgames/following{/other_user}","gists_url":"https://api.github.com/users/fredfishgames/gists{/gist_id}","starred_url":"https://api.github.com/users/fredfishgames/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fredfishgames/subscriptions","organizations_url":"https://api.github.com/users/fredfishgames/orgs","repos_url":"https://api.github.com/users/fredfishgames/repos","events_url":"https://api.github.com/users/fredfishgames/events{/privacy}","received_events_url":"https://api.github.com/users/fredfishgames/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/fredfishgames/zulip","description":"Zulip server - powerful open source group chat","fork":true,"url":"https://api.github.com/repos/fredfishgames/zulip","forks_url":"https://api.github.com/repos/fredfishgames/zulip/forks","keys_url":"https://api.github.com/repos/fredfishgames/zulip/keys{/key_id}","collaborators_url":"https://api.github.com/repos/fredfishgames/zulip/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/fredfishgames/zulip/teams","hooks_url":"https://api.github.com/repos/fredfishgames/zulip/hooks","issue_events_url":"https://api.github.com/repos/fredfishgames/zulip/issues/events{/number}","events_url":"https://api.github.com/repos/fredfishgames/zulip/events","assignees_url":"https://api.github.com/repos/fredfishgames/zulip/assignees{/user}","branches_url":"https://api.github.com/repos/fredfishgames/zulip/branches{/branch}","tags_url":"https://api.github.com/repos/fredfishgames/zulip/tags","blobs_url":"https://api.github.com/repos/fredfishgames/zulip/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/fredfishgames/zulip/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/fredfishgames/zulip/git/refs{/sha}","trees_url":"https://api.github.com/repos/fredfishgames/zulip/git/trees{/sha}","statuses_url":"https://api.github.com/repos/fredfishgames/zulip/statuses/{sha}","languages_url":"https://api.github.com/repos/fredfishgames/zulip/languages","stargazers_url":"https://api.github.com/repos/fredfishgames/zulip/stargazers","contributors_url":"https://api.github.com/repos/fredfishgames/zulip/contributors","subscribers_url":"https://api.github.com/repos/fredfishgames/zulip/subscribers","subscription_url":"https://api.github.com/repos/fredfishgames/zulip/subscription","commits_url":"https://api.github.com/repos/fredfishgames/zulip/commits{/sha}","git_commits_url":"https://api.github.com/repos/fredfishgames/zulip/git/commits{/sha}","comments_url":"https://api.github.com/repos/fredfishgames/zulip/comments{/number}","issue_comment_url":"https://api.github.com/repos/fredfishgames/zulip/issues/comments{/number}","contents_url":"https://api.github.com/repos/fredfishgames/zulip/contents/{+path}","compare_url":"https://api.github.com/repos/fredfishgames/zulip/compare/{base}...{head}","merges_url":"https://api.github.com/repos/fredfishgames/zulip/merges","archive_url":"https://api.github.com/repos/fredfishgames/zulip/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/fredfishgames/zulip/downloads","issues_url":"https://api.github.com/repos/fredfishgames/zulip/issues{/number}","pulls_url":"https://api.github.com/repos/fredfishgames/zulip/pulls{/number}","milestones_url":"https://api.github.com/repos/fredfishgames/zulip/milestones{/number}","notifications_url":"https://api.github.com/repos/fredfishgames/zulip/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/fredfishgames/zulip/labels{/name}","releases_url":"https://api.github.com/repos/fredfishgames/zulip/releases{/id}","deployments_url":"https://api.github.com/repos/fredfishgames/zulip/deployments","created_at":"2016-12-11T08:54:31Z","updated_at":"2016-12-12T20:21:10Z","pushed_at":"2016-12-13T19:56:06Z","git_url":"git://github.com/fredfishgames/zulip.git","ssh_url":"git@github.com:fredfishgames/zulip.git","clone_url":"https://github.com/fredfishgames/zulip.git","svn_url":"https://github.com/fredfishgames/zulip","homepage":"","size":123398,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"zulip:master","ref":"master","sha":"fae59502ab09b1ee457ed6c41bc301cd35f2c505","user":{"login":"zulip","id":4921959,"avatar_url":"https://avatars.githubusercontent.com/u/4921959?v=3","gravatar_id":"","url":"https://api.github.com/users/zulip","html_url":"https://github.com/zulip","followers_url":"https://api.github.com/users/zulip/followers","following_url":"https://api.github.com/users/zulip/following{/other_user}","gists_url":"https://api.github.com/users/zulip/gists{/gist_id}","starred_url":"https://api.github.com/users/zulip/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zulip/subscriptions","organizations_url":"https://api.github.com/users/zulip/orgs","repos_url":"https://api.github.com/users/zulip/repos","events_url":"https://api.github.com/users/zulip/events{/privacy}","received_events_url":"https://api.github.com/users/zulip/received_events","type":"Organization","site_admin":false},"repo":{"id":43160685,"name":"zulip","full_name":"zulip/zulip","owner":{"login":"zulip","id":4921959,"avatar_url":"https://avatars.githubusercontent.com/u/4921959?v=3","gravatar_id":"","url":"https://api.github.com/users/zulip","html_url":"https://github.com/zulip","followers_url":"https://api.github.com/users/zulip/followers","following_url":"https://api.github.com/users/zulip/following{/other_user}","gists_url":"https://api.github.com/users/zulip/gists{/gist_id}","starred_url":"https://api.github.com/users/zulip/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zulip/subscriptions","organizations_url":"https://api.github.com/users/zulip/orgs","repos_url":"https://api.github.com/users/zulip/repos","events_url":"https://api.github.com/users/zulip/events{/privacy}","received_events_url":"https://api.github.com/users/zulip/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/zulip/zulip","description":"Zulip server - powerful open source group chat","fork":false,"url":"https://api.github.com/repos/zulip/zulip","forks_url":"https://api.github.com/repos/zulip/zulip/forks","keys_url":"https://api.github.com/repos/zulip/zulip/keys{/key_id}","collaborators_url":"https://api.github.com/repos/zulip/zulip/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/zulip/zulip/teams","hooks_url":"https://api.github.com/repos/zulip/zulip/hooks","issue_events_url":"https://api.github.com/repos/zulip/zulip/issues/events{/number}","events_url":"https://api.github.com/repos/zulip/zulip/events","assignees_url":"https://api.github.com/repos/zulip/zulip/assignees{/user}","branches_url":"https://api.github.com/repos/zulip/zulip/branches{/branch}","tags_url":"https://api.github.com/repos/zulip/zulip/tags","blobs_url":"https://api.github.com/repos/zulip/zulip/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/zulip/zulip/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/zulip/zulip/git/refs{/sha}","trees_url":"https://api.github.com/repos/zulip/zulip/git/trees{/sha}","statuses_url":"https://api.github.com/repos/zulip/zulip/statuses/{sha}","languages_url":"https://api.github.com/repos/zulip/zulip/languages","stargazers_url":"https://api.github.com/repos/zulip/zulip/stargazers","contributors_url":"https://api.github.com/repos/zulip/zulip/contributors","subscribers_url":"https://api.github.com/repos/zulip/zulip/subscribers","subscription_url":"https://api.github.com/repos/zulip/zulip/subscription","commits_url":"https://api.github.com/repos/zulip/zulip/commits{/sha}","git_commits_url":"https://api.github.com/repos/zulip/zulip/git/commits{/sha}","comments_url":"https://api.github.com/repos/zulip/zulip/comments{/number}","issue_comment_url":"https://api.github.com/repos/zulip/zulip/issues/comments{/number}","contents_url":"https://api.github.com/repos/zulip/zulip/contents/{+path}","compare_url":"https://api.github.com/repos/zulip/zulip/compare/{base}...{head}","merges_url":"https://api.github.com/repos/zulip/zulip/merges","archive_url":"https://api.github.com/repos/zulip/zulip/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/zulip/zulip/downloads","issues_url":"https://api.github.com/repos/zulip/zulip/issues{/number}","pulls_url":"https://api.github.com/repos/zulip/zulip/pulls{/number}","milestones_url":"https://api.github.com/repos/zulip/zulip/milestones{/number}","notifications_url":"https://api.github.com/repos/zulip/zulip/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/zulip/zulip/labels{/name}","releases_url":"https://api.github.com/repos/zulip/zulip/releases{/id}","deployments_url":"https://api.github.com/repos/zulip/zulip/deployments","created_at":"2015-09-25T16:37:25Z","updated_at":"2016-12-14T01:50:43Z","pushed_at":"2016-12-14T04:35:43Z","git_url":"git://github.com/zulip/zulip.git","ssh_url":"git@github.com:zulip/zulip.git","clone_url":"https://github.com/zulip/zulip.git","svn_url":"https://github.com/zulip/zulip","homepage":"","size":124069,"stargazers_count":4328,"watchers_count":4328,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":920,"mirror_url":null,"open_issues_count":626,"forks":920,"open_issues":626,"watchers":4328,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/zulip/zulip/pulls/2688"},"html":{"href":"https://github.com/zulip/zulip/pull/2688"},"issue":{"href":"https://api.github.com/repos/zulip/zulip/issues/2688"},"comments":{"href":"https://api.github.com/repos/zulip/zulip/issues/2688/comments"},"review_comments":{"href":"https://api.github.com/repos/zulip/zulip/pulls/2688/comments"},"review_comment":{"href":"https://api.github.com/repos/zulip/zulip/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/zulip/zulip/pulls/2688/commits"},"statuses":{"href":"https://api.github.com/repos/zulip/zulip/statuses/e2cf111fcd420a78743166e885cd4f4f41f81624"}}}}
{"actor":{"display_login":"umairwaheed"}}