{"action":"created","comment":{"url":"https://api.github.com/repos/mintuz/BB8-Commander/pulls/comments/50229753","id":50229753,"diff_hunk":"@@ -0,0 +1,33 @@\n+var TwitterClient = require('../libs/twitter-client-instance');\n+\n+function getLatestStatus(tweets) {\n+    return tweets.statuses[0];\n+}\n+\n+module.exports = function (bb8) {\n+    console.log('Let\\'s Get Tweets!!');\n+\n+    var executeTwitterCommand = function () {\n+        TwitterClient.get('search/tweets', {q: 'bb8bbc'}, function (error, tweets) {","path":"commands/tweet.js","position":11,"original_position":11,"commit_id":"6effc3c0ddd3b8c95c90a51c41913f9d94d03811","original_commit_id":"6effc3c0ddd3b8c95c90a51c41913f9d94d03811","user":{"login":"citypaul","id":5850178,"avatar_url":"https://avatars.githubusercontent.com/u/5850178?v=3","gravatar_id":"","url":"https://api.github.com/users/citypaul","html_url":"https://github.com/citypaul","followers_url":"https://api.github.com/users/citypaul/followers","following_url":"https://api.github.com/users/citypaul/following{/other_user}","gists_url":"https://api.github.com/users/citypaul/gists{/gist_id}","starred_url":"https://api.github.com/users/citypaul/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/citypaul/subscriptions","organizations_url":"https://api.github.com/users/citypaul/orgs","repos_url":"https://api.github.com/users/citypaul/repos","events_url":"https://api.github.com/users/citypaul/events{/privacy}","received_events_url":"https://api.github.com/users/citypaul/received_events","type":"User","site_admin":false},"body":"Yeah, was thinking that... Just ran out of time to play with it last night... I'll make the change later :)","created_at":"2016-01-20T09:14:57Z","updated_at":"2016-01-20T09:14:57Z","html_url":"https://github.com/mintuz/BB8-Commander/pull/6#discussion_r50229753","pull_request_url":"https://api.github.com/repos/mintuz/BB8-Commander/pulls/6","_links":{"self":{"href":"https://api.github.com/repos/mintuz/BB8-Commander/pulls/comments/50229753"},"html":{"href":"https://github.com/mintuz/BB8-Commander/pull/6#discussion_r50229753"},"pull_request":{"href":"https://api.github.com/repos/mintuz/BB8-Commander/pulls/6"}}},"pull_request":{"url":"https://api.github.com/repos/mintuz/BB8-Commander/pulls/6","id":56545154,"html_url":"https://github.com/mintuz/BB8-Commander/pull/6","diff_url":"https://github.com/mintuz/BB8-Commander/pull/6.diff","patch_url":"https://github.com/mintuz/BB8-Commander/pull/6.patch","issue_url":"https://api.github.com/repos/mintuz/BB8-Commander/issues/6","number":6,"state":"open","locked":false,"title":"Twitter commands","user":{"login":"citypaul","id":5850178,"avatar_url":"https://avatars.githubusercontent.com/u/5850178?v=3","gravatar_id":"","url":"https://api.github.com/users/citypaul","html_url":"https://github.com/citypaul","followers_url":"https://api.github.com/users/citypaul/followers","following_url":"https://api.github.com/users/citypaul/following{/other_user}","gists_url":"https://api.github.com/users/citypaul/gists{/gist_id}","starred_url":"https://api.github.com/users/citypaul/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/citypaul/subscriptions","organizations_url":"https://api.github.com/users/citypaul/orgs","repos_url":"https://api.github.com/users/citypaul/repos","events_url":"https://api.github.com/users/citypaul/events{/privacy}","received_events_url":"https://api.github.com/users/citypaul/received_events","type":"User","site_admin":false},"body":"So I made a few changes here to make the twitter stuff a bit nicer.\r\n\r\nI should say I'm doing this blind without a robot and without... tests! Shock horror! So I can't confirm it works unless you try it out for me.\r\n\r\nI refactored some of the commands so they no longer create the bb8 instance. I figured they are just commands and should do nothing more than take an instance of bb8 that is already created and run commands against him. This meant I could then pass commands from twitter quite easily. I had a go at refactoring the index script accordingly.\r\n\r\nThere's a `config` folder with a place for you to store your twitter api details. I couldn't see a way of using twitter's api without these details. If there is a way please alter the code or let me know and I'll do it...\r\n\r\nThe twitter command is pretty basic at the moment - it polls twitter every 10 seconds searching for the hashtag #bb8bbc, and then looks for the first hashtag it finds in that tweet. It then simply issues that as the command.\r\n\r\nIt doesn't check to see whether the command exists or deal with more than one command etc right now, but it's a start.\r\n\r\nSo to make BB8 roll you'd do:\r\n\r\n`#roll #bb8bbc`\r\n\r\nI think extracting the commands as functions that simply receive a bb8 instance is a nice improvement - removes duplication and means you could start combining the commands together in theory.\r\n\r\nDunno if it works though! Try it out :)\r\n","created_at":"2016-01-19T23:58:19Z","updated_at":"2016-01-20T09:14:57Z","closed_at":null,"merged_at":null,"merge_commit_sha":"65b2419a96429fbcac01e02cfabf944cde4d04c1","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/mintuz/BB8-Commander/pulls/6/commits","review_comments_url":"https://api.github.com/repos/mintuz/BB8-Commander/pulls/6/comments","review_comment_url":"https://api.github.com/repos/mintuz/BB8-Commander/pulls/comments{/number}","comments_url":"https://api.github.com/repos/mintuz/BB8-Commander/issues/6/comments","statuses_url":"https://api.github.com/repos/mintuz/BB8-Commander/statuses/6effc3c0ddd3b8c95c90a51c41913f9d94d03811","head":{"label":"citypaul:twitter","ref":"twitter","sha":"6effc3c0ddd3b8c95c90a51c41913f9d94d03811","user":{"login":"citypaul","id":5850178,"avatar_url":"https://avatars.githubusercontent.com/u/5850178?v=3","gravatar_id":"","url":"https://api.github.com/users/citypaul","html_url":"https://github.com/citypaul","followers_url":"https://api.github.com/users/citypaul/followers","following_url":"https://api.github.com/users/citypaul/following{/other_user}","gists_url":"https://api.github.com/users/citypaul/gists{/gist_id}","starred_url":"https://api.github.com/users/citypaul/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/citypaul/subscriptions","organizations_url":"https://api.github.com/users/citypaul/orgs","repos_url":"https://api.github.com/users/citypaul/repos","events_url":"https://api.github.com/users/citypaul/events{/privacy}","received_events_url":"https://api.github.com/users/citypaul/received_events","type":"User","site_admin":false},"repo":{"id":49991200,"name":"BB8-Commander","full_name":"citypaul/BB8-Commander","owner":{"login":"citypaul","id":5850178,"avatar_url":"https://avatars.githubusercontent.com/u/5850178?v=3","gravatar_id":"","url":"https://api.github.com/users/citypaul","html_url":"https://github.com/citypaul","followers_url":"https://api.github.com/users/citypaul/followers","following_url":"https://api.github.com/users/citypaul/following{/other_user}","gists_url":"https://api.github.com/users/citypaul/gists{/gist_id}","starred_url":"https://api.github.com/users/citypaul/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/citypaul/subscriptions","organizations_url":"https://api.github.com/users/citypaul/orgs","repos_url":"https://api.github.com/users/citypaul/repos","events_url":"https://api.github.com/users/citypaul/events{/privacy}","received_events_url":"https://api.github.com/users/citypaul/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/citypaul/BB8-Commander","description":"A Node CLI Tool for the Sphero BB8 Robot every loves.","fork":true,"url":"https://api.github.com/repos/citypaul/BB8-Commander","forks_url":"https://api.github.com/repos/citypaul/BB8-Commander/forks","keys_url":"https://api.github.com/repos/citypaul/BB8-Commander/keys{/key_id}","collaborators_url":"https://api.github.com/repos/citypaul/BB8-Commander/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/citypaul/BB8-Commander/teams","hooks_url":"https://api.github.com/repos/citypaul/BB8-Commander/hooks","issue_events_url":"https://api.github.com/repos/citypaul/BB8-Commander/issues/events{/number}","events_url":"https://api.github.com/repos/citypaul/BB8-Commander/events","assignees_url":"https://api.github.com/repos/citypaul/BB8-Commander/assignees{/user}","branches_url":"https://api.github.com/repos/citypaul/BB8-Commander/branches{/branch}","tags_url":"https://api.github.com/repos/citypaul/BB8-Commander/tags","blobs_url":"https://api.github.com/repos/citypaul/BB8-Commander/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/citypaul/BB8-Commander/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/citypaul/BB8-Commander/git/refs{/sha}","trees_url":"https://api.github.com/repos/citypaul/BB8-Commander/git/trees{/sha}","statuses_url":"https://api.github.com/repos/citypaul/BB8-Commander/statuses/{sha}","languages_url":"https://api.github.com/repos/citypaul/BB8-Commander/languages","stargazers_url":"https://api.github.com/repos/citypaul/BB8-Commander/stargazers","contributors_url":"https://api.github.com/repos/citypaul/BB8-Commander/contributors","subscribers_url":"https://api.github.com/repos/citypaul/BB8-Commander/subscribers","subscription_url":"https://api.github.com/repos/citypaul/BB8-Commander/subscription","commits_url":"https://api.github.com/repos/citypaul/BB8-Commander/commits{/sha}","git_commits_url":"https://api.github.com/repos/citypaul/BB8-Commander/git/commits{/sha}","comments_url":"https://api.github.com/repos/citypaul/BB8-Commander/comments{/number}","issue_comment_url":"https://api.github.com/repos/citypaul/BB8-Commander/issues/comments{/number}","contents_url":"https://api.github.com/repos/citypaul/BB8-Commander/contents/{+path}","compare_url":"https://api.github.com/repos/citypaul/BB8-Commander/compare/{base}...{head}","merges_url":"https://api.github.com/repos/citypaul/BB8-Commander/merges","archive_url":"https://api.github.com/repos/citypaul/BB8-Commander/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/citypaul/BB8-Commander/downloads","issues_url":"https://api.github.com/repos/citypaul/BB8-Commander/issues{/number}","pulls_url":"https://api.github.com/repos/citypaul/BB8-Commander/pulls{/number}","milestones_url":"https://api.github.com/repos/citypaul/BB8-Commander/milestones{/number}","notifications_url":"https://api.github.com/repos/citypaul/BB8-Commander/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/citypaul/BB8-Commander/labels{/name}","releases_url":"https://api.github.com/repos/citypaul/BB8-Commander/releases{/id}","created_at":"2016-01-19T23:44:39Z","updated_at":"2016-01-19T23:44:40Z","pushed_at":"2016-01-20T01:33:09Z","git_url":"git://github.com/citypaul/BB8-Commander.git","ssh_url":"git@github.com:citypaul/BB8-Commander.git","clone_url":"https://github.com/citypaul/BB8-Commander.git","svn_url":"https://github.com/citypaul/BB8-Commander","homepage":"","size":33,"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":"mintuz:master","ref":"master","sha":"208956d892910da5f1dce0c0d2870c55253056e9","user":{"login":"mintuz","id":447031,"avatar_url":"https://avatars.githubusercontent.com/u/447031?v=3","gravatar_id":"","url":"https://api.github.com/users/mintuz","html_url":"https://github.com/mintuz","followers_url":"https://api.github.com/users/mintuz/followers","following_url":"https://api.github.com/users/mintuz/following{/other_user}","gists_url":"https://api.github.com/users/mintuz/gists{/gist_id}","starred_url":"https://api.github.com/users/mintuz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mintuz/subscriptions","organizations_url":"https://api.github.com/users/mintuz/orgs","repos_url":"https://api.github.com/users/mintuz/repos","events_url":"https://api.github.com/users/mintuz/events{/privacy}","received_events_url":"https://api.github.com/users/mintuz/received_events","type":"User","site_admin":false},"repo":{"id":49903567,"name":"BB8-Commander","full_name":"mintuz/BB8-Commander","owner":{"login":"mintuz","id":447031,"avatar_url":"https://avatars.githubusercontent.com/u/447031?v=3","gravatar_id":"","url":"https://api.github.com/users/mintuz","html_url":"https://github.com/mintuz","followers_url":"https://api.github.com/users/mintuz/followers","following_url":"https://api.github.com/users/mintuz/following{/other_user}","gists_url":"https://api.github.com/users/mintuz/gists{/gist_id}","starred_url":"https://api.github.com/users/mintuz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mintuz/subscriptions","organizations_url":"https://api.github.com/users/mintuz/orgs","repos_url":"https://api.github.com/users/mintuz/repos","events_url":"https://api.github.com/users/mintuz/events{/privacy}","received_events_url":"https://api.github.com/users/mintuz/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/mintuz/BB8-Commander","description":"A Node CLI Tool for the Sphero BB8 Robot every loves.","fork":false,"url":"https://api.github.com/repos/mintuz/BB8-Commander","forks_url":"https://api.github.com/repos/mintuz/BB8-Commander/forks","keys_url":"https://api.github.com/repos/mintuz/BB8-Commander/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mintuz/BB8-Commander/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mintuz/BB8-Commander/teams","hooks_url":"https://api.github.com/repos/mintuz/BB8-Commander/hooks","issue_events_url":"https://api.github.com/repos/mintuz/BB8-Commander/issues/events{/number}","events_url":"https://api.github.com/repos/mintuz/BB8-Commander/events","assignees_url":"https://api.github.com/repos/mintuz/BB8-Commander/assignees{/user}","branches_url":"https://api.github.com/repos/mintuz/BB8-Commander/branches{/branch}","tags_url":"https://api.github.com/repos/mintuz/BB8-Commander/tags","blobs_url":"https://api.github.com/repos/mintuz/BB8-Commander/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mintuz/BB8-Commander/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mintuz/BB8-Commander/git/refs{/sha}","trees_url":"https://api.github.com/repos/mintuz/BB8-Commander/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mintuz/BB8-Commander/statuses/{sha}","languages_url":"https://api.github.com/repos/mintuz/BB8-Commander/languages","stargazers_url":"https://api.github.com/repos/mintuz/BB8-Commander/stargazers","contributors_url":"https://api.github.com/repos/mintuz/BB8-Commander/contributors","subscribers_url":"https://api.github.com/repos/mintuz/BB8-Commander/subscribers","subscription_url":"https://api.github.com/repos/mintuz/BB8-Commander/subscription","commits_url":"https://api.github.com/repos/mintuz/BB8-Commander/commits{/sha}","git_commits_url":"https://api.github.com/repos/mintuz/BB8-Commander/git/commits{/sha}","comments_url":"https://api.github.com/repos/mintuz/BB8-Commander/comments{/number}","issue_comment_url":"https://api.github.com/repos/mintuz/BB8-Commander/issues/comments{/number}","contents_url":"https://api.github.com/repos/mintuz/BB8-Commander/contents/{+path}","compare_url":"https://api.github.com/repos/mintuz/BB8-Commander/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mintuz/BB8-Commander/merges","archive_url":"https://api.github.com/repos/mintuz/BB8-Commander/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mintuz/BB8-Commander/downloads","issues_url":"https://api.github.com/repos/mintuz/BB8-Commander/issues{/number}","pulls_url":"https://api.github.com/repos/mintuz/BB8-Commander/pulls{/number}","milestones_url":"https://api.github.com/repos/mintuz/BB8-Commander/milestones{/number}","notifications_url":"https://api.github.com/repos/mintuz/BB8-Commander/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mintuz/BB8-Commander/labels{/name}","releases_url":"https://api.github.com/repos/mintuz/BB8-Commander/releases{/id}","created_at":"2016-01-18T20:35:35Z","updated_at":"2016-01-20T08:03:51Z","pushed_at":"2016-01-20T01:33:09Z","git_url":"git://github.com/mintuz/BB8-Commander.git","ssh_url":"git@github.com:mintuz/BB8-Commander.git","clone_url":"https://github.com/mintuz/BB8-Commander.git","svn_url":"https://github.com/mintuz/BB8-Commander","homepage":"","size":33,"stargazers_count":2,"watchers_count":2,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":6,"forks":1,"open_issues":6,"watchers":2,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/mintuz/BB8-Commander/pulls/6"},"html":{"href":"https://github.com/mintuz/BB8-Commander/pull/6"},"issue":{"href":"https://api.github.com/repos/mintuz/BB8-Commander/issues/6"},"comments":{"href":"https://api.github.com/repos/mintuz/BB8-Commander/issues/6/comments"},"review_comments":{"href":"https://api.github.com/repos/mintuz/BB8-Commander/pulls/6/comments"},"review_comment":{"href":"https://api.github.com/repos/mintuz/BB8-Commander/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/mintuz/BB8-Commander/pulls/6/commits"},"statuses":{"href":"https://api.github.com/repos/mintuz/BB8-Commander/statuses/6effc3c0ddd3b8c95c90a51c41913f9d94d03811"}}}}