diff options
author | Valentin Popov <info@valentineus.link> | 2017-10-09 18:35:38 +0300 |
---|---|---|
committer | Valentin Popov <info@valentineus.link> | 2017-10-09 18:35:38 +0300 |
commit | fd54adf4291e601db06b0f384290c5be8450a191 (patch) | |
tree | 8a43d7744ab13994b0f9fd08db9e8925b40b9bf5 /README.md | |
parent | 21076233e57ee238776cd27430e16c3e1fc5aee4 (diff) | |
download | iii-client-fd54adf4291e601db06b0f384290c5be8450a191.tar.xz iii-client-fd54adf4291e601db06b0f384290c5be8450a191.zip |
Update the example
Diffstat (limited to 'README.md')
-rw-r--r-- | README.md | 15 |
1 files changed, 7 insertions, 8 deletions
@@ -32,18 +32,17 @@ An example of a connection, receiving session identification and sending a bot m import { connect, send } from 'iii-client'; var uuid = '109cd867-0ef3-4473-af71-7543a9b2fccd'; +var cuid = '0340feab-b09e-4960-96e9-c9518b1fb157'; var text = 'Hello, World!'; /* We connect to the system and get a session */ connect(uuid, (request) => { - console.info(`Session: ${request}`); - /* Send the message and process the response */ - if (request.result) { - var cuid = request.result.cuid; - send(cuid, text, (answer) => { - console.info(`Answer: ${answer}`); - }); - } + console.info(`Session: ${request.result.cuid}`); +}); + +/* Send the message and process the response */ +send(cuid, text, (answer) => { + console.info(`Answer: ${answer.result.text.value}`); }); ``` |