{"action":"created","comment":{"url":"https://api.github.com/repos/cpjk/woz/pulls/comments/38274608","id":38274608,"diff_hunk":"@@ -39,39 +64,79 @@ module.exports = (robot) ->\n           msg.send solutionHint\n       , 15000\n \n-  #function to turn off trivia\n-  #made this so i could reset every time a question is done\n-  triviaStop = (msg) ->\n-    clearInterval(hintInterval)\n-    hintInterval = null\n-    triviaOn = false\n-    \n-  #solve attempt matches anything after !, case insensitive\n-  #need to add some way to score points\n-  robot.respond /!(.+)$/i, (msg) ->\n-    solveAttempt = msg.match[1]\n+  #-------------Solve Attempt-----------------#\n+  #solve attempt matches anything after ?  \n+  robot.respond /\\?\\s*(.+)$/i, (msg) ->\n+    solveAttempt = msg.match[1].trim()\n     if solveAttempt.toLowerCase() == currentSolution.toLowerCase()\n       msg.reply \"Ding Ding Ding, you are correct!\"\n+      \n+      #get user and add 1 point to their score\n+      username = msg.message.user.name\n+      points[username] ?= 0\n+      points[username] += 1\n+\n+      #update points object in db\n+      robot.brain.data.points = points\n+\n+      msg.reply \"You currently have \" + points[username] + \" points\"\n+\n       triviaStop(msg)\n       triviaStart(msg)\n     else\n       msg.reply \"Incorrect!\"\n-\n-  #command to turn off trivia\n-  robot.respond /trivia off/i, (msg) ->\n+  \n+  #---------------Trivia Toggling---------------#\n+  #used for setting new question and turning off trivia\n+  triviaStop = (msg) ->\n+    clearInterval(hintInterval)","path":"scripts/trivia.coffee","position":106,"original_position":106,"commit_id":"c03a29033e13664275e664655cb9002585a0e06b","original_commit_id":"c03a29033e13664275e664655cb9002585a0e06b","user":{"login":"andreirtaylor","id":6440936,"avatar_url":"https://avatars.githubusercontent.com/u/6440936?v=3","gravatar_id":"","url":"https://api.github.com/users/andreirtaylor","html_url":"https://github.com/andreirtaylor","followers_url":"https://api.github.com/users/andreirtaylor/followers","following_url":"https://api.github.com/users/andreirtaylor/following{/other_user}","gists_url":"https://api.github.com/users/andreirtaylor/gists{/gist_id}","starred_url":"https://api.github.com/users/andreirtaylor/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/andreirtaylor/subscriptions","organizations_url":"https://api.github.com/users/andreirtaylor/orgs","repos_url":"https://api.github.com/users/andreirtaylor/repos","events_url":"https://api.github.com/users/andreirtaylor/events{/privacy}","received_events_url":"https://api.github.com/users/andreirtaylor/received_events","type":"User","site_admin":false},"body":"dont need these brackets","created_at":"2015-08-30T18:52:01Z","updated_at":"2015-08-30T18:52:01Z","html_url":"https://github.com/cpjk/woz/pull/12#discussion_r38274608","pull_request_url":"https://api.github.com/repos/cpjk/woz/pulls/12","_links":{"self":{"href":"https://api.github.com/repos/cpjk/woz/pulls/comments/38274608"},"html":{"href":"https://github.com/cpjk/woz/pull/12#discussion_r38274608"},"pull_request":{"href":"https://api.github.com/repos/cpjk/woz/pulls/12"}}},"pull_request":{"url":"https://api.github.com/repos/cpjk/woz/pulls/12","id":43087117,"html_url":"https://github.com/cpjk/woz/pull/12","diff_url":"https://github.com/cpjk/woz/pull/12.diff","patch_url":"https://github.com/cpjk/woz/pull/12.patch","issue_url":"https://api.github.com/repos/cpjk/woz/issues/12","number":12,"state":"open","locked":false,"title":"add points system, leaderboard, better formatted question","user":{"login":"jboretsky","id":6702400,"avatar_url":"https://avatars.githubusercontent.com/u/6702400?v=3","gravatar_id":"","url":"https://api.github.com/users/jboretsky","html_url":"https://github.com/jboretsky","followers_url":"https://api.github.com/users/jboretsky/followers","following_url":"https://api.github.com/users/jboretsky/following{/other_user}","gists_url":"https://api.github.com/users/jboretsky/gists{/gist_id}","starred_url":"https://api.github.com/users/jboretsky/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jboretsky/subscriptions","organizations_url":"https://api.github.com/users/jboretsky/orgs","repos_url":"https://api.github.com/users/jboretsky/repos","events_url":"https://api.github.com/users/jboretsky/events{/privacy}","received_events_url":"https://api.github.com/users/jboretsky/received_events","type":"User","site_admin":false},"body":"Yo yo,\r\nthis is working pretty well with the cli, want to test it out on slack.\r\nUsing robot.brain for storing data. I think it's only semi persistent and it'll be lost when the robot is rebooted but i wanna see how it works first before trying to figure out how to use a more persistent database.\r\nI also added a leaderboard that shows top 10 scores and fixed some of the buggy solutions that come from that api. Still need to find a better one.. some of these questions are ridiculous.","created_at":"2015-08-21T22:24:36Z","updated_at":"2015-08-30T18:52:01Z","closed_at":null,"merged_at":null,"merge_commit_sha":"c4f94c8fe8749377ffe04b53c48c4eadde5e49bf","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/cpjk/woz/pulls/12/commits","review_comments_url":"https://api.github.com/repos/cpjk/woz/pulls/12/comments","review_comment_url":"https://api.github.com/repos/cpjk/woz/pulls/comments{/number}","comments_url":"https://api.github.com/repos/cpjk/woz/issues/12/comments","statuses_url":"https://api.github.com/repos/cpjk/woz/statuses/c03a29033e13664275e664655cb9002585a0e06b","head":{"label":"jboretsky:master","ref":"master","sha":"c03a29033e13664275e664655cb9002585a0e06b","user":{"login":"jboretsky","id":6702400,"avatar_url":"https://avatars.githubusercontent.com/u/6702400?v=3","gravatar_id":"","url":"https://api.github.com/users/jboretsky","html_url":"https://github.com/jboretsky","followers_url":"https://api.github.com/users/jboretsky/followers","following_url":"https://api.github.com/users/jboretsky/following{/other_user}","gists_url":"https://api.github.com/users/jboretsky/gists{/gist_id}","starred_url":"https://api.github.com/users/jboretsky/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jboretsky/subscriptions","organizations_url":"https://api.github.com/users/jboretsky/orgs","repos_url":"https://api.github.com/users/jboretsky/repos","events_url":"https://api.github.com/users/jboretsky/events{/privacy}","received_events_url":"https://api.github.com/users/jboretsky/received_events","type":"User","site_admin":false},"repo":{"id":41179731,"name":"woz","full_name":"jboretsky/woz","owner":{"login":"jboretsky","id":6702400,"avatar_url":"https://avatars.githubusercontent.com/u/6702400?v=3","gravatar_id":"","url":"https://api.github.com/users/jboretsky","html_url":"https://github.com/jboretsky","followers_url":"https://api.github.com/users/jboretsky/followers","following_url":"https://api.github.com/users/jboretsky/following{/other_user}","gists_url":"https://api.github.com/users/jboretsky/gists{/gist_id}","starred_url":"https://api.github.com/users/jboretsky/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jboretsky/subscriptions","organizations_url":"https://api.github.com/users/jboretsky/orgs","repos_url":"https://api.github.com/users/jboretsky/repos","events_url":"https://api.github.com/users/jboretsky/events{/privacy}","received_events_url":"https://api.github.com/users/jboretsky/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/jboretsky/woz","description":"IRC bot for uvic-cs.slack.com","fork":true,"url":"https://api.github.com/repos/jboretsky/woz","forks_url":"https://api.github.com/repos/jboretsky/woz/forks","keys_url":"https://api.github.com/repos/jboretsky/woz/keys{/key_id}","collaborators_url":"https://api.github.com/repos/jboretsky/woz/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/jboretsky/woz/teams","hooks_url":"https://api.github.com/repos/jboretsky/woz/hooks","issue_events_url":"https://api.github.com/repos/jboretsky/woz/issues/events{/number}","events_url":"https://api.github.com/repos/jboretsky/woz/events","assignees_url":"https://api.github.com/repos/jboretsky/woz/assignees{/user}","branches_url":"https://api.github.com/repos/jboretsky/woz/branches{/branch}","tags_url":"https://api.github.com/repos/jboretsky/woz/tags","blobs_url":"https://api.github.com/repos/jboretsky/woz/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/jboretsky/woz/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/jboretsky/woz/git/refs{/sha}","trees_url":"https://api.github.com/repos/jboretsky/woz/git/trees{/sha}","statuses_url":"https://api.github.com/repos/jboretsky/woz/statuses/{sha}","languages_url":"https://api.github.com/repos/jboretsky/woz/languages","stargazers_url":"https://api.github.com/repos/jboretsky/woz/stargazers","contributors_url":"https://api.github.com/repos/jboretsky/woz/contributors","subscribers_url":"https://api.github.com/repos/jboretsky/woz/subscribers","subscription_url":"https://api.github.com/repos/jboretsky/woz/subscription","commits_url":"https://api.github.com/repos/jboretsky/woz/commits{/sha}","git_commits_url":"https://api.github.com/repos/jboretsky/woz/git/commits{/sha}","comments_url":"https://api.github.com/repos/jboretsky/woz/comments{/number}","issue_comment_url":"https://api.github.com/repos/jboretsky/woz/issues/comments{/number}","contents_url":"https://api.github.com/repos/jboretsky/woz/contents/{+path}","compare_url":"https://api.github.com/repos/jboretsky/woz/compare/{base}...{head}","merges_url":"https://api.github.com/repos/jboretsky/woz/merges","archive_url":"https://api.github.com/repos/jboretsky/woz/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/jboretsky/woz/downloads","issues_url":"https://api.github.com/repos/jboretsky/woz/issues{/number}","pulls_url":"https://api.github.com/repos/jboretsky/woz/pulls{/number}","milestones_url":"https://api.github.com/repos/jboretsky/woz/milestones{/number}","notifications_url":"https://api.github.com/repos/jboretsky/woz/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/jboretsky/woz/labels{/name}","releases_url":"https://api.github.com/repos/jboretsky/woz/releases{/id}","created_at":"2015-08-21T22:15:42Z","updated_at":"2015-08-21T22:15:43Z","pushed_at":"2015-08-23T19:49:41Z","git_url":"git://github.com/jboretsky/woz.git","ssh_url":"git@github.com:jboretsky/woz.git","clone_url":"https://github.com/jboretsky/woz.git","svn_url":"https://github.com/jboretsky/woz","homepage":null,"size":168,"stargazers_count":0,"watchers_count":0,"language":"CoffeeScript","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":"cpjk:master","ref":"master","sha":"d737de3fa681e5a766efd1527daecb7159038a85","user":{"login":"cpjk","id":3213506,"avatar_url":"https://avatars.githubusercontent.com/u/3213506?v=3","gravatar_id":"","url":"https://api.github.com/users/cpjk","html_url":"https://github.com/cpjk","followers_url":"https://api.github.com/users/cpjk/followers","following_url":"https://api.github.com/users/cpjk/following{/other_user}","gists_url":"https://api.github.com/users/cpjk/gists{/gist_id}","starred_url":"https://api.github.com/users/cpjk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cpjk/subscriptions","organizations_url":"https://api.github.com/users/cpjk/orgs","repos_url":"https://api.github.com/users/cpjk/repos","events_url":"https://api.github.com/users/cpjk/events{/privacy}","received_events_url":"https://api.github.com/users/cpjk/received_events","type":"User","site_admin":false},"repo":{"id":33287093,"name":"woz","full_name":"cpjk/woz","owner":{"login":"cpjk","id":3213506,"avatar_url":"https://avatars.githubusercontent.com/u/3213506?v=3","gravatar_id":"","url":"https://api.github.com/users/cpjk","html_url":"https://github.com/cpjk","followers_url":"https://api.github.com/users/cpjk/followers","following_url":"https://api.github.com/users/cpjk/following{/other_user}","gists_url":"https://api.github.com/users/cpjk/gists{/gist_id}","starred_url":"https://api.github.com/users/cpjk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cpjk/subscriptions","organizations_url":"https://api.github.com/users/cpjk/orgs","repos_url":"https://api.github.com/users/cpjk/repos","events_url":"https://api.github.com/users/cpjk/events{/privacy}","received_events_url":"https://api.github.com/users/cpjk/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/cpjk/woz","description":"IRC bot for uvic-cs.slack.com","fork":false,"url":"https://api.github.com/repos/cpjk/woz","forks_url":"https://api.github.com/repos/cpjk/woz/forks","keys_url":"https://api.github.com/repos/cpjk/woz/keys{/key_id}","collaborators_url":"https://api.github.com/repos/cpjk/woz/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/cpjk/woz/teams","hooks_url":"https://api.github.com/repos/cpjk/woz/hooks","issue_events_url":"https://api.github.com/repos/cpjk/woz/issues/events{/number}","events_url":"https://api.github.com/repos/cpjk/woz/events","assignees_url":"https://api.github.com/repos/cpjk/woz/assignees{/user}","branches_url":"https://api.github.com/repos/cpjk/woz/branches{/branch}","tags_url":"https://api.github.com/repos/cpjk/woz/tags","blobs_url":"https://api.github.com/repos/cpjk/woz/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/cpjk/woz/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/cpjk/woz/git/refs{/sha}","trees_url":"https://api.github.com/repos/cpjk/woz/git/trees{/sha}","statuses_url":"https://api.github.com/repos/cpjk/woz/statuses/{sha}","languages_url":"https://api.github.com/repos/cpjk/woz/languages","stargazers_url":"https://api.github.com/repos/cpjk/woz/stargazers","contributors_url":"https://api.github.com/repos/cpjk/woz/contributors","subscribers_url":"https://api.github.com/repos/cpjk/woz/subscribers","subscription_url":"https://api.github.com/repos/cpjk/woz/subscription","commits_url":"https://api.github.com/repos/cpjk/woz/commits{/sha}","git_commits_url":"https://api.github.com/repos/cpjk/woz/git/commits{/sha}","comments_url":"https://api.github.com/repos/cpjk/woz/comments{/number}","issue_comment_url":"https://api.github.com/repos/cpjk/woz/issues/comments{/number}","contents_url":"https://api.github.com/repos/cpjk/woz/contents/{+path}","compare_url":"https://api.github.com/repos/cpjk/woz/compare/{base}...{head}","merges_url":"https://api.github.com/repos/cpjk/woz/merges","archive_url":"https://api.github.com/repos/cpjk/woz/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/cpjk/woz/downloads","issues_url":"https://api.github.com/repos/cpjk/woz/issues{/number}","pulls_url":"https://api.github.com/repos/cpjk/woz/pulls{/number}","milestones_url":"https://api.github.com/repos/cpjk/woz/milestones{/number}","notifications_url":"https://api.github.com/repos/cpjk/woz/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/cpjk/woz/labels{/name}","releases_url":"https://api.github.com/repos/cpjk/woz/releases{/id}","created_at":"2015-04-02T03:24:14Z","updated_at":"2015-07-06T18:18:11Z","pushed_at":"2015-08-23T19:49:41Z","git_url":"git://github.com/cpjk/woz.git","ssh_url":"git@github.com:cpjk/woz.git","clone_url":"https://github.com/cpjk/woz.git","svn_url":"https://github.com/cpjk/woz","homepage":null,"size":313,"stargazers_count":3,"watchers_count":3,"language":"CoffeeScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":3,"mirror_url":null,"open_issues_count":1,"forks":3,"open_issues":1,"watchers":3,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/cpjk/woz/pulls/12"},"html":{"href":"https://github.com/cpjk/woz/pull/12"},"issue":{"href":"https://api.github.com/repos/cpjk/woz/issues/12"},"comments":{"href":"https://api.github.com/repos/cpjk/woz/issues/12/comments"},"review_comments":{"href":"https://api.github.com/repos/cpjk/woz/pulls/12/comments"},"review_comment":{"href":"https://api.github.com/repos/cpjk/woz/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/cpjk/woz/pulls/12/commits"},"statuses":{"href":"https://api.github.com/repos/cpjk/woz/statuses/c03a29033e13664275e664655cb9002585a0e06b"}}}}