{"action":"created","comment":{"url":"https://api.github.com/repos/Zarel/Pokemon-Showdown/pulls/comments/40387414","id":40387414,"diff_hunk":"@@ -0,0 +1,149 @@\n+/*\n+* Poll chat plugin\n+* This plugin allows roomauth (default: moderator and above) to run a poll in a room.\n+* Every room can have one poll, and every user can vote. The results are displayed for\n+* users that have voted, and are updated in real time. The poll can be closed with /endpoll.\n+* By bumbadadabum with (a lot of) help from Zarel.\n+*/\n+\n+var Poll = (function () {\n+\tfunction Poll(room, question, options) {\n+\t\tthis.room = room;\n+\t\tthis.question = question;\n+\t\tthis.voters = new Map();\n+\t\tthis.totalVotes = 0;\n+\n+\t\tthis.options = new Map();\n+\t\tfor (var i = 0; i < options.length; i++) {\n+\t\t\tthis.options.set(i + 1, {name: options[i], votes: 0});\n+\t\t}\n+\t}\n+\n+\tPoll.prototype.vote = function (user, option) {\n+\t\tfor (var ip = 0; ip < user.ips.length; ip++) {\n+\t\t\tif (this.voters.get(ip)) {\n+\t\t\t\treturn this.room.send(\"You have already voted for this poll.\");","path":"chat-plugins/poll.js","position":25,"original_position":25,"commit_id":"4d228a4678b66453259fa37a425537fbd69ea1ba","original_commit_id":"4d228a4678b66453259fa37a425537fbd69ea1ba","user":{"login":"Slayer95","id":4925744,"avatar_url":"https://avatars.githubusercontent.com/u/4925744?v=3","gravatar_id":"","url":"https://api.github.com/users/Slayer95","html_url":"https://github.com/Slayer95","followers_url":"https://api.github.com/users/Slayer95/followers","following_url":"https://api.github.com/users/Slayer95/following{/other_user}","gists_url":"https://api.github.com/users/Slayer95/gists{/gist_id}","starred_url":"https://api.github.com/users/Slayer95/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Slayer95/subscriptions","organizations_url":"https://api.github.com/users/Slayer95/orgs","repos_url":"https://api.github.com/users/Slayer95/repos","events_url":"https://api.github.com/users/Slayer95/events{/privacy}","received_events_url":"https://api.github.com/users/Slayer95/received_events","type":"User","site_admin":false},"body":"This sends the message to every user in the room :s","created_at":"2015-09-24T23:52:36Z","updated_at":"2015-09-24T23:52:36Z","html_url":"https://github.com/Zarel/Pokemon-Showdown/pull/2177#discussion_r40387414","pull_request_url":"https://api.github.com/repos/Zarel/Pokemon-Showdown/pulls/2177","_links":{"self":{"href":"https://api.github.com/repos/Zarel/Pokemon-Showdown/pulls/comments/40387414"},"html":{"href":"https://github.com/Zarel/Pokemon-Showdown/pull/2177#discussion_r40387414"},"pull_request":{"href":"https://api.github.com/repos/Zarel/Pokemon-Showdown/pulls/2177"}}},"pull_request":{"url":"https://api.github.com/repos/Zarel/Pokemon-Showdown/pulls/2177","id":45953207,"html_url":"https://github.com/Zarel/Pokemon-Showdown/pull/2177","diff_url":"https://github.com/Zarel/Pokemon-Showdown/pull/2177.diff","patch_url":"https://github.com/Zarel/Pokemon-Showdown/pull/2177.patch","issue_url":"https://api.github.com/repos/Zarel/Pokemon-Showdown/issues/2177","number":2177,"state":"open","locked":false,"title":"Implement polls (serverside code)","user":{"login":"bumbadadabum","id":4457584,"avatar_url":"https://avatars.githubusercontent.com/u/4457584?v=3","gravatar_id":"","url":"https://api.github.com/users/bumbadadabum","html_url":"https://github.com/bumbadadabum","followers_url":"https://api.github.com/users/bumbadadabum/followers","following_url":"https://api.github.com/users/bumbadadabum/following{/other_user}","gists_url":"https://api.github.com/users/bumbadadabum/gists{/gist_id}","starred_url":"https://api.github.com/users/bumbadadabum/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bumbadadabum/subscriptions","organizations_url":"https://api.github.com/users/bumbadadabum/orgs","repos_url":"https://api.github.com/users/bumbadadabum/repos","events_url":"https://api.github.com/users/bumbadadabum/events{/privacy}","received_events_url":"https://api.github.com/users/bumbadadabum/received_events","type":"User","site_admin":false},"body":"","created_at":"2015-09-24T21:37:32Z","updated_at":"2015-09-24T23:52:36Z","closed_at":null,"merged_at":null,"merge_commit_sha":"13feb8de33b8cbc5800be9abcfe5b924ebe72a85","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/Zarel/Pokemon-Showdown/pulls/2177/commits","review_comments_url":"https://api.github.com/repos/Zarel/Pokemon-Showdown/pulls/2177/comments","review_comment_url":"https://api.github.com/repos/Zarel/Pokemon-Showdown/pulls/comments{/number}","comments_url":"https://api.github.com/repos/Zarel/Pokemon-Showdown/issues/2177/comments","statuses_url":"https://api.github.com/repos/Zarel/Pokemon-Showdown/statuses/4d228a4678b66453259fa37a425537fbd69ea1ba","head":{"label":"bumbadadabum:poll","ref":"poll","sha":"4d228a4678b66453259fa37a425537fbd69ea1ba","user":{"login":"bumbadadabum","id":4457584,"avatar_url":"https://avatars.githubusercontent.com/u/4457584?v=3","gravatar_id":"","url":"https://api.github.com/users/bumbadadabum","html_url":"https://github.com/bumbadadabum","followers_url":"https://api.github.com/users/bumbadadabum/followers","following_url":"https://api.github.com/users/bumbadadabum/following{/other_user}","gists_url":"https://api.github.com/users/bumbadadabum/gists{/gist_id}","starred_url":"https://api.github.com/users/bumbadadabum/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bumbadadabum/subscriptions","organizations_url":"https://api.github.com/users/bumbadadabum/orgs","repos_url":"https://api.github.com/users/bumbadadabum/repos","events_url":"https://api.github.com/users/bumbadadabum/events{/privacy}","received_events_url":"https://api.github.com/users/bumbadadabum/received_events","type":"User","site_admin":false},"repo":{"id":13387180,"name":"Pokemon-Showdown","full_name":"bumbadadabum/Pokemon-Showdown","owner":{"login":"bumbadadabum","id":4457584,"avatar_url":"https://avatars.githubusercontent.com/u/4457584?v=3","gravatar_id":"","url":"https://api.github.com/users/bumbadadabum","html_url":"https://github.com/bumbadadabum","followers_url":"https://api.github.com/users/bumbadadabum/followers","following_url":"https://api.github.com/users/bumbadadabum/following{/other_user}","gists_url":"https://api.github.com/users/bumbadadabum/gists{/gist_id}","starred_url":"https://api.github.com/users/bumbadadabum/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bumbadadabum/subscriptions","organizations_url":"https://api.github.com/users/bumbadadabum/orgs","repos_url":"https://api.github.com/users/bumbadadabum/repos","events_url":"https://api.github.com/users/bumbadadabum/events{/privacy}","received_events_url":"https://api.github.com/users/bumbadadabum/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/bumbadadabum/Pokemon-Showdown","description":"Pokémon battle simulator.","fork":true,"url":"https://api.github.com/repos/bumbadadabum/Pokemon-Showdown","forks_url":"https://api.github.com/repos/bumbadadabum/Pokemon-Showdown/forks","keys_url":"https://api.github.com/repos/bumbadadabum/Pokemon-Showdown/keys{/key_id}","collaborators_url":"https://api.github.com/repos/bumbadadabum/Pokemon-Showdown/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/bumbadadabum/Pokemon-Showdown/teams","hooks_url":"https://api.github.com/repos/bumbadadabum/Pokemon-Showdown/hooks","issue_events_url":"https://api.github.com/repos/bumbadadabum/Pokemon-Showdown/issues/events{/number}","events_url":"https://api.github.com/repos/bumbadadabum/Pokemon-Showdown/events","assignees_url":"https://api.github.com/repos/bumbadadabum/Pokemon-Showdown/assignees{/user}","branches_url":"https://api.github.com/repos/bumbadadabum/Pokemon-Showdown/branches{/branch}","tags_url":"https://api.github.com/repos/bumbadadabum/Pokemon-Showdown/tags","blobs_url":"https://api.github.com/repos/bumbadadabum/Pokemon-Showdown/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/bumbadadabum/Pokemon-Showdown/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/bumbadadabum/Pokemon-Showdown/git/refs{/sha}","trees_url":"https://api.github.com/repos/bumbadadabum/Pokemon-Showdown/git/trees{/sha}","statuses_url":"https://api.github.com/repos/bumbadadabum/Pokemon-Showdown/statuses/{sha}","languages_url":"https://api.github.com/repos/bumbadadabum/Pokemon-Showdown/languages","stargazers_url":"https://api.github.com/repos/bumbadadabum/Pokemon-Showdown/stargazers","contributors_url":"https://api.github.com/repos/bumbadadabum/Pokemon-Showdown/contributors","subscribers_url":"https://api.github.com/repos/bumbadadabum/Pokemon-Showdown/subscribers","subscription_url":"https://api.github.com/repos/bumbadadabum/Pokemon-Showdown/subscription","commits_url":"https://api.github.com/repos/bumbadadabum/Pokemon-Showdown/commits{/sha}","git_commits_url":"https://api.github.com/repos/bumbadadabum/Pokemon-Showdown/git/commits{/sha}","comments_url":"https://api.github.com/repos/bumbadadabum/Pokemon-Showdown/comments{/number}","issue_comment_url":"https://api.github.com/repos/bumbadadabum/Pokemon-Showdown/issues/comments{/number}","contents_url":"https://api.github.com/repos/bumbadadabum/Pokemon-Showdown/contents/{+path}","compare_url":"https://api.github.com/repos/bumbadadabum/Pokemon-Showdown/compare/{base}...{head}","merges_url":"https://api.github.com/repos/bumbadadabum/Pokemon-Showdown/merges","archive_url":"https://api.github.com/repos/bumbadadabum/Pokemon-Showdown/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/bumbadadabum/Pokemon-Showdown/downloads","issues_url":"https://api.github.com/repos/bumbadadabum/Pokemon-Showdown/issues{/number}","pulls_url":"https://api.github.com/repos/bumbadadabum/Pokemon-Showdown/pulls{/number}","milestones_url":"https://api.github.com/repos/bumbadadabum/Pokemon-Showdown/milestones{/number}","notifications_url":"https://api.github.com/repos/bumbadadabum/Pokemon-Showdown/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/bumbadadabum/Pokemon-Showdown/labels{/name}","releases_url":"https://api.github.com/repos/bumbadadabum/Pokemon-Showdown/releases{/id}","created_at":"2013-10-07T15:14:56Z","updated_at":"2015-02-12T00:51:43Z","pushed_at":"2015-09-24T23:35:55Z","git_url":"git://github.com/bumbadadabum/Pokemon-Showdown.git","ssh_url":"git@github.com:bumbadadabum/Pokemon-Showdown.git","clone_url":"https://github.com/bumbadadabum/Pokemon-Showdown.git","svn_url":"https://github.com/bumbadadabum/Pokemon-Showdown","homepage":"http://pokemonshowdown.com","size":43462,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"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":"Zarel:master","ref":"master","sha":"d7901d098a1ede2e4357e9267b0b7ab5bf192955","user":{"login":"Zarel","id":551184,"avatar_url":"https://avatars.githubusercontent.com/u/551184?v=3","gravatar_id":"","url":"https://api.github.com/users/Zarel","html_url":"https://github.com/Zarel","followers_url":"https://api.github.com/users/Zarel/followers","following_url":"https://api.github.com/users/Zarel/following{/other_user}","gists_url":"https://api.github.com/users/Zarel/gists{/gist_id}","starred_url":"https://api.github.com/users/Zarel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Zarel/subscriptions","organizations_url":"https://api.github.com/users/Zarel/orgs","repos_url":"https://api.github.com/users/Zarel/repos","events_url":"https://api.github.com/users/Zarel/events{/privacy}","received_events_url":"https://api.github.com/users/Zarel/received_events","type":"User","site_admin":false},"repo":{"id":3038446,"name":"Pokemon-Showdown","full_name":"Zarel/Pokemon-Showdown","owner":{"login":"Zarel","id":551184,"avatar_url":"https://avatars.githubusercontent.com/u/551184?v=3","gravatar_id":"","url":"https://api.github.com/users/Zarel","html_url":"https://github.com/Zarel","followers_url":"https://api.github.com/users/Zarel/followers","following_url":"https://api.github.com/users/Zarel/following{/other_user}","gists_url":"https://api.github.com/users/Zarel/gists{/gist_id}","starred_url":"https://api.github.com/users/Zarel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Zarel/subscriptions","organizations_url":"https://api.github.com/users/Zarel/orgs","repos_url":"https://api.github.com/users/Zarel/repos","events_url":"https://api.github.com/users/Zarel/events{/privacy}","received_events_url":"https://api.github.com/users/Zarel/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/Zarel/Pokemon-Showdown","description":"Pokémon battle simulator.","fork":false,"url":"https://api.github.com/repos/Zarel/Pokemon-Showdown","forks_url":"https://api.github.com/repos/Zarel/Pokemon-Showdown/forks","keys_url":"https://api.github.com/repos/Zarel/Pokemon-Showdown/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Zarel/Pokemon-Showdown/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Zarel/Pokemon-Showdown/teams","hooks_url":"https://api.github.com/repos/Zarel/Pokemon-Showdown/hooks","issue_events_url":"https://api.github.com/repos/Zarel/Pokemon-Showdown/issues/events{/number}","events_url":"https://api.github.com/repos/Zarel/Pokemon-Showdown/events","assignees_url":"https://api.github.com/repos/Zarel/Pokemon-Showdown/assignees{/user}","branches_url":"https://api.github.com/repos/Zarel/Pokemon-Showdown/branches{/branch}","tags_url":"https://api.github.com/repos/Zarel/Pokemon-Showdown/tags","blobs_url":"https://api.github.com/repos/Zarel/Pokemon-Showdown/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Zarel/Pokemon-Showdown/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Zarel/Pokemon-Showdown/git/refs{/sha}","trees_url":"https://api.github.com/repos/Zarel/Pokemon-Showdown/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Zarel/Pokemon-Showdown/statuses/{sha}","languages_url":"https://api.github.com/repos/Zarel/Pokemon-Showdown/languages","stargazers_url":"https://api.github.com/repos/Zarel/Pokemon-Showdown/stargazers","contributors_url":"https://api.github.com/repos/Zarel/Pokemon-Showdown/contributors","subscribers_url":"https://api.github.com/repos/Zarel/Pokemon-Showdown/subscribers","subscription_url":"https://api.github.com/repos/Zarel/Pokemon-Showdown/subscription","commits_url":"https://api.github.com/repos/Zarel/Pokemon-Showdown/commits{/sha}","git_commits_url":"https://api.github.com/repos/Zarel/Pokemon-Showdown/git/commits{/sha}","comments_url":"https://api.github.com/repos/Zarel/Pokemon-Showdown/comments{/number}","issue_comment_url":"https://api.github.com/repos/Zarel/Pokemon-Showdown/issues/comments{/number}","contents_url":"https://api.github.com/repos/Zarel/Pokemon-Showdown/contents/{+path}","compare_url":"https://api.github.com/repos/Zarel/Pokemon-Showdown/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Zarel/Pokemon-Showdown/merges","archive_url":"https://api.github.com/repos/Zarel/Pokemon-Showdown/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Zarel/Pokemon-Showdown/downloads","issues_url":"https://api.github.com/repos/Zarel/Pokemon-Showdown/issues{/number}","pulls_url":"https://api.github.com/repos/Zarel/Pokemon-Showdown/pulls{/number}","milestones_url":"https://api.github.com/repos/Zarel/Pokemon-Showdown/milestones{/number}","notifications_url":"https://api.github.com/repos/Zarel/Pokemon-Showdown/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Zarel/Pokemon-Showdown/labels{/name}","releases_url":"https://api.github.com/repos/Zarel/Pokemon-Showdown/releases{/id}","created_at":"2011-12-23T04:52:33Z","updated_at":"2015-09-23T14:28:27Z","pushed_at":"2015-09-24T23:35:55Z","git_url":"git://github.com/Zarel/Pokemon-Showdown.git","ssh_url":"git@github.com:Zarel/Pokemon-Showdown.git","clone_url":"https://github.com/Zarel/Pokemon-Showdown.git","svn_url":"https://github.com/Zarel/Pokemon-Showdown","homepage":"http://pokemonshowdown.com","size":97505,"stargazers_count":576,"watchers_count":576,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":753,"mirror_url":null,"open_issues_count":34,"forks":753,"open_issues":34,"watchers":576,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/Zarel/Pokemon-Showdown/pulls/2177"},"html":{"href":"https://github.com/Zarel/Pokemon-Showdown/pull/2177"},"issue":{"href":"https://api.github.com/repos/Zarel/Pokemon-Showdown/issues/2177"},"comments":{"href":"https://api.github.com/repos/Zarel/Pokemon-Showdown/issues/2177/comments"},"review_comments":{"href":"https://api.github.com/repos/Zarel/Pokemon-Showdown/pulls/2177/comments"},"review_comment":{"href":"https://api.github.com/repos/Zarel/Pokemon-Showdown/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/Zarel/Pokemon-Showdown/pulls/2177/commits"},"statuses":{"href":"https://api.github.com/repos/Zarel/Pokemon-Showdown/statuses/4d228a4678b66453259fa37a425537fbd69ea1ba"}}}}