{"action":"created","comment":{"url":"https://api.github.com/repos/bespoken/bst/pulls/comments/135279872","pull_request_review_id":58678255,"id":135279872,"diff_hunk":"@@ -30,62 +27,50 @@ program\n         }\n \n         // Just by casting program to options, we can get all the options which are set on it\n-        let options: any = program;\n-        let url = options.url;\n-        let intentSchemaPath = options.intents;\n-        let samplesPath = options.samples;\n-        let applicationID = options.appId;\n+        const options: any = program;\n+        const token = options.token;\n \n-        if (options.url === undefined) {\n-            let proxyProcess = Global.running();\n-            if (proxyProcess === null) {\n-                console.error(\"No URL specified and no proxy is currently running\");\n+        let silentEchoResponse;\n+        try {\n+            silentEchoResponse = await SilentEchoClient.speak(utterance, token);\n+        } catch (error) {\n+            if (error.message === \"Token Required\") {\n+                console.log(\"You need a token for this option to work, get it here:\");\n                 console.log();\n-                console.log(\"URL (--url) must be specified if no proxy is currently running\");\n+                console.log(\"\\thttps://apps.bespoken.io/dashboard/validation\");\n+                console.log(\"\\t(Bespoken Dashboard account required for use of this feature)\");\n                 console.log();\n-                console.log(\"If a proxy is running, utterances will automatically be sent to it\");\n+                console.log(\"Then try again with:\");\n+                console.log();\n+                console.log(\"\\tbst speak --token <ProvidedToken> <Speech to try>\");\n                 console.log();\n                 process.exit(0);\n                 return;\n             }\n-\n-            url = \"http://localhost:\" + proxyProcess.port;\n+            // Different issue, we throw to be catch by the general error handler.\n+            throw error;\n         }\n \n-        let speaker = new BSTAlexa(url, intentSchemaPath, samplesPath, applicationID);\n+        if (token) {\n+            console.log(\"Your token is saved, you can now use this command without providing a token\");\n+        }\n \n-        speaker.start(function (error: string) {\n-            if (error !== undefined) {\n-                process.exit(0);\n-                return;\n-            }\n+        console.log(\"Transcript:\");","path":"bin/bst-speak.ts","position":78,"original_position":78,"commit_id":"34bddbbed20f0b11edcdc056fd6f4bec03b41dcd","original_commit_id":"41a7fab6ad1d96a62085689482b7c55d6201a950","user":{"login":"jkelvie","id":17267,"avatar_url":"https://avatars0.githubusercontent.com/u/17267?v=4","gravatar_id":"","url":"https://api.github.com/users/jkelvie","html_url":"https://github.com/jkelvie","followers_url":"https://api.github.com/users/jkelvie/followers","following_url":"https://api.github.com/users/jkelvie/following{/other_user}","gists_url":"https://api.github.com/users/jkelvie/gists{/gist_id}","starred_url":"https://api.github.com/users/jkelvie/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jkelvie/subscriptions","organizations_url":"https://api.github.com/users/jkelvie/orgs","repos_url":"https://api.github.com/users/jkelvie/repos","events_url":"https://api.github.com/users/jkelvie/events{/privacy}","received_events_url":"https://api.github.com/users/jkelvie/received_events","type":"User","site_admin":false},"body":"I would move the logic for calling SilentEcho and formatting the output to its own class. For two reasons:\r\n1) The logic is a bit more complex, with lots of ifs (as almost anything can be null)\r\n2) We will keep adding to it, with render templates, video, etc.\r\nThese additional may even require us creating HTML output, so the user can view it.\r\n\r\nFor that reason, having this handling in its own class makes sense","created_at":"2017-08-25T15:00:03Z","updated_at":"2017-08-25T15:29:41Z","html_url":"https://github.com/bespoken/bst/pull/369#discussion_r135279872","pull_request_url":"https://api.github.com/repos/bespoken/bst/pulls/369","_links":{"self":{"href":"https://api.github.com/repos/bespoken/bst/pulls/comments/135279872"},"html":{"href":"https://github.com/bespoken/bst/pull/369#discussion_r135279872"},"pull_request":{"href":"https://api.github.com/repos/bespoken/bst/pulls/369"}}},"pull_request":{"url":"https://api.github.com/repos/bespoken/bst/pulls/369","id":137581031,"html_url":"https://github.com/bespoken/bst/pull/369","diff_url":"https://github.com/bespoken/bst/pull/369.diff","patch_url":"https://github.com/bespoken/bst/pull/369.patch","issue_url":"https://api.github.com/repos/bespoken/bst/issues/369","number":369,"state":"open","locked":false,"title":"New Speak Command connected to Virtual Alexa Device ","user":{"login":"jperata","id":8781604,"avatar_url":"https://avatars3.githubusercontent.com/u/8781604?v=4","gravatar_id":"","url":"https://api.github.com/users/jperata","html_url":"https://github.com/jperata","followers_url":"https://api.github.com/users/jperata/followers","following_url":"https://api.github.com/users/jperata/following{/other_user}","gists_url":"https://api.github.com/users/jperata/gists{/gist_id}","starred_url":"https://api.github.com/users/jperata/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jperata/subscriptions","organizations_url":"https://api.github.com/users/jperata/orgs","repos_url":"https://api.github.com/users/jperata/repos","events_url":"https://api.github.com/users/jperata/events{/privacy}","received_events_url":"https://api.github.com/users/jperata/received_events","type":"User","site_admin":false},"body":"(Closes #359)\r\n\r\nThis PR is not yet ready to merge, putting it out there for revision on the logic.\r\n\r\nWhat it has:\r\n - Rename old speak command to utter.\r\n - Add handler for silent echo sdk.\r\n - Create new speak command connecting with silent echo as specified on #359 \r\n\r\nWhat is missing:\r\n - Update documentation for utter and speak.\r\n - Tests for new speak command.\r\n - Current implementation returns the \"The Silent Echo service is no longer available.\" mesage.\r\n - ~We need #368 to be merged first into master and then into this branch to solve test failures.~","created_at":"2017-08-25T00:57:12Z","updated_at":"2017-08-25T15:29:42Z","closed_at":null,"merged_at":null,"merge_commit_sha":"f3f348c6ffa483c63e47198c48c0a23b69e5b074","assignee":null,"assignees":[],"requested_reviewers":[],"milestone":null,"commits_url":"https://api.github.com/repos/bespoken/bst/pulls/369/commits","review_comments_url":"https://api.github.com/repos/bespoken/bst/pulls/369/comments","review_comment_url":"https://api.github.com/repos/bespoken/bst/pulls/comments{/number}","comments_url":"https://api.github.com/repos/bespoken/bst/issues/369/comments","statuses_url":"https://api.github.com/repos/bespoken/bst/statuses/34bddbbed20f0b11edcdc056fd6f4bec03b41dcd","head":{"label":"bespoken:speakSilentEcho#359","ref":"speakSilentEcho#359","sha":"34bddbbed20f0b11edcdc056fd6f4bec03b41dcd","user":{"login":"bespoken","id":20362367,"avatar_url":"https://avatars3.githubusercontent.com/u/20362367?v=4","gravatar_id":"","url":"https://api.github.com/users/bespoken","html_url":"https://github.com/bespoken","followers_url":"https://api.github.com/users/bespoken/followers","following_url":"https://api.github.com/users/bespoken/following{/other_user}","gists_url":"https://api.github.com/users/bespoken/gists{/gist_id}","starred_url":"https://api.github.com/users/bespoken/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bespoken/subscriptions","organizations_url":"https://api.github.com/users/bespoken/orgs","repos_url":"https://api.github.com/users/bespoken/repos","events_url":"https://api.github.com/users/bespoken/events{/privacy}","received_events_url":"https://api.github.com/users/bespoken/received_events","type":"Organization","site_admin":false},"repo":{"id":62768027,"name":"bst","full_name":"bespoken/bst","owner":{"login":"bespoken","id":20362367,"avatar_url":"https://avatars3.githubusercontent.com/u/20362367?v=4","gravatar_id":"","url":"https://api.github.com/users/bespoken","html_url":"https://github.com/bespoken","followers_url":"https://api.github.com/users/bespoken/followers","following_url":"https://api.github.com/users/bespoken/following{/other_user}","gists_url":"https://api.github.com/users/bespoken/gists{/gist_id}","starred_url":"https://api.github.com/users/bespoken/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bespoken/subscriptions","organizations_url":"https://api.github.com/users/bespoken/orgs","repos_url":"https://api.github.com/users/bespoken/repos","events_url":"https://api.github.com/users/bespoken/events{/privacy}","received_events_url":"https://api.github.com/users/bespoken/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/bespoken/bst","description":":wrench: Bespoken Tools - Tools for making voice apps faster and better","fork":false,"url":"https://api.github.com/repos/bespoken/bst","forks_url":"https://api.github.com/repos/bespoken/bst/forks","keys_url":"https://api.github.com/repos/bespoken/bst/keys{/key_id}","collaborators_url":"https://api.github.com/repos/bespoken/bst/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/bespoken/bst/teams","hooks_url":"https://api.github.com/repos/bespoken/bst/hooks","issue_events_url":"https://api.github.com/repos/bespoken/bst/issues/events{/number}","events_url":"https://api.github.com/repos/bespoken/bst/events","assignees_url":"https://api.github.com/repos/bespoken/bst/assignees{/user}","branches_url":"https://api.github.com/repos/bespoken/bst/branches{/branch}","tags_url":"https://api.github.com/repos/bespoken/bst/tags","blobs_url":"https://api.github.com/repos/bespoken/bst/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/bespoken/bst/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/bespoken/bst/git/refs{/sha}","trees_url":"https://api.github.com/repos/bespoken/bst/git/trees{/sha}","statuses_url":"https://api.github.com/repos/bespoken/bst/statuses/{sha}","languages_url":"https://api.github.com/repos/bespoken/bst/languages","stargazers_url":"https://api.github.com/repos/bespoken/bst/stargazers","contributors_url":"https://api.github.com/repos/bespoken/bst/contributors","subscribers_url":"https://api.github.com/repos/bespoken/bst/subscribers","subscription_url":"https://api.github.com/repos/bespoken/bst/subscription","commits_url":"https://api.github.com/repos/bespoken/bst/commits{/sha}","git_commits_url":"https://api.github.com/repos/bespoken/bst/git/commits{/sha}","comments_url":"https://api.github.com/repos/bespoken/bst/comments{/number}","issue_comment_url":"https://api.github.com/repos/bespoken/bst/issues/comments{/number}","contents_url":"https://api.github.com/repos/bespoken/bst/contents/{+path}","compare_url":"https://api.github.com/repos/bespoken/bst/compare/{base}...{head}","merges_url":"https://api.github.com/repos/bespoken/bst/merges","archive_url":"https://api.github.com/repos/bespoken/bst/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/bespoken/bst/downloads","issues_url":"https://api.github.com/repos/bespoken/bst/issues{/number}","pulls_url":"https://api.github.com/repos/bespoken/bst/pulls{/number}","milestones_url":"https://api.github.com/repos/bespoken/bst/milestones{/number}","notifications_url":"https://api.github.com/repos/bespoken/bst/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/bespoken/bst/labels{/name}","releases_url":"https://api.github.com/repos/bespoken/bst/releases{/id}","deployments_url":"https://api.github.com/repos/bespoken/bst/deployments","created_at":"2016-07-07T02:23:05Z","updated_at":"2017-08-23T21:08:07Z","pushed_at":"2017-08-25T15:23:13Z","git_url":"git://github.com/bespoken/bst.git","ssh_url":"git@github.com:bespoken/bst.git","clone_url":"https://github.com/bespoken/bst.git","svn_url":"https://github.com/bespoken/bst","homepage":"https://bespoken.io","size":8407,"stargazers_count":105,"watchers_count":105,"language":"TypeScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":8,"mirror_url":null,"open_issues_count":54,"forks":8,"open_issues":54,"watchers":105,"default_branch":"master"}},"base":{"label":"bespoken:master","ref":"master","sha":"f8cfd67d8163449917e775c41446634ace1b682c","user":{"login":"bespoken","id":20362367,"avatar_url":"https://avatars3.githubusercontent.com/u/20362367?v=4","gravatar_id":"","url":"https://api.github.com/users/bespoken","html_url":"https://github.com/bespoken","followers_url":"https://api.github.com/users/bespoken/followers","following_url":"https://api.github.com/users/bespoken/following{/other_user}","gists_url":"https://api.github.com/users/bespoken/gists{/gist_id}","starred_url":"https://api.github.com/users/bespoken/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bespoken/subscriptions","organizations_url":"https://api.github.com/users/bespoken/orgs","repos_url":"https://api.github.com/users/bespoken/repos","events_url":"https://api.github.com/users/bespoken/events{/privacy}","received_events_url":"https://api.github.com/users/bespoken/received_events","type":"Organization","site_admin":false},"repo":{"id":62768027,"name":"bst","full_name":"bespoken/bst","owner":{"login":"bespoken","id":20362367,"avatar_url":"https://avatars3.githubusercontent.com/u/20362367?v=4","gravatar_id":"","url":"https://api.github.com/users/bespoken","html_url":"https://github.com/bespoken","followers_url":"https://api.github.com/users/bespoken/followers","following_url":"https://api.github.com/users/bespoken/following{/other_user}","gists_url":"https://api.github.com/users/bespoken/gists{/gist_id}","starred_url":"https://api.github.com/users/bespoken/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bespoken/subscriptions","organizations_url":"https://api.github.com/users/bespoken/orgs","repos_url":"https://api.github.com/users/bespoken/repos","events_url":"https://api.github.com/users/bespoken/events{/privacy}","received_events_url":"https://api.github.com/users/bespoken/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/bespoken/bst","description":":wrench: Bespoken Tools - Tools for making voice apps faster and better","fork":false,"url":"https://api.github.com/repos/bespoken/bst","forks_url":"https://api.github.com/repos/bespoken/bst/forks","keys_url":"https://api.github.com/repos/bespoken/bst/keys{/key_id}","collaborators_url":"https://api.github.com/repos/bespoken/bst/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/bespoken/bst/teams","hooks_url":"https://api.github.com/repos/bespoken/bst/hooks","issue_events_url":"https://api.github.com/repos/bespoken/bst/issues/events{/number}","events_url":"https://api.github.com/repos/bespoken/bst/events","assignees_url":"https://api.github.com/repos/bespoken/bst/assignees{/user}","branches_url":"https://api.github.com/repos/bespoken/bst/branches{/branch}","tags_url":"https://api.github.com/repos/bespoken/bst/tags","blobs_url":"https://api.github.com/repos/bespoken/bst/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/bespoken/bst/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/bespoken/bst/git/refs{/sha}","trees_url":"https://api.github.com/repos/bespoken/bst/git/trees{/sha}","statuses_url":"https://api.github.com/repos/bespoken/bst/statuses/{sha}","languages_url":"https://api.github.com/repos/bespoken/bst/languages","stargazers_url":"https://api.github.com/repos/bespoken/bst/stargazers","contributors_url":"https://api.github.com/repos/bespoken/bst/contributors","subscribers_url":"https://api.github.com/repos/bespoken/bst/subscribers","subscription_url":"https://api.github.com/repos/bespoken/bst/subscription","commits_url":"https://api.github.com/repos/bespoken/bst/commits{/sha}","git_commits_url":"https://api.github.com/repos/bespoken/bst/git/commits{/sha}","comments_url":"https://api.github.com/repos/bespoken/bst/comments{/number}","issue_comment_url":"https://api.github.com/repos/bespoken/bst/issues/comments{/number}","contents_url":"https://api.github.com/repos/bespoken/bst/contents/{+path}","compare_url":"https://api.github.com/repos/bespoken/bst/compare/{base}...{head}","merges_url":"https://api.github.com/repos/bespoken/bst/merges","archive_url":"https://api.github.com/repos/bespoken/bst/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/bespoken/bst/downloads","issues_url":"https://api.github.com/repos/bespoken/bst/issues{/number}","pulls_url":"https://api.github.com/repos/bespoken/bst/pulls{/number}","milestones_url":"https://api.github.com/repos/bespoken/bst/milestones{/number}","notifications_url":"https://api.github.com/repos/bespoken/bst/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/bespoken/bst/labels{/name}","releases_url":"https://api.github.com/repos/bespoken/bst/releases{/id}","deployments_url":"https://api.github.com/repos/bespoken/bst/deployments","created_at":"2016-07-07T02:23:05Z","updated_at":"2017-08-23T21:08:07Z","pushed_at":"2017-08-25T15:23:13Z","git_url":"git://github.com/bespoken/bst.git","ssh_url":"git@github.com:bespoken/bst.git","clone_url":"https://github.com/bespoken/bst.git","svn_url":"https://github.com/bespoken/bst","homepage":"https://bespoken.io","size":8407,"stargazers_count":105,"watchers_count":105,"language":"TypeScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":8,"mirror_url":null,"open_issues_count":54,"forks":8,"open_issues":54,"watchers":105,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/bespoken/bst/pulls/369"},"html":{"href":"https://github.com/bespoken/bst/pull/369"},"issue":{"href":"https://api.github.com/repos/bespoken/bst/issues/369"},"comments":{"href":"https://api.github.com/repos/bespoken/bst/issues/369/comments"},"review_comments":{"href":"https://api.github.com/repos/bespoken/bst/pulls/369/comments"},"review_comment":{"href":"https://api.github.com/repos/bespoken/bst/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/bespoken/bst/pulls/369/commits"},"statuses":{"href":"https://api.github.com/repos/bespoken/bst/statuses/34bddbbed20f0b11edcdc056fd6f4bec03b41dcd"}}}}
{"actor":{"display_login":"jkelvie"}}