mirror of
https://github.com/valentineus/iii-client.git
synced 2025-04-29 01:51:24 +03:00
Release of version 1.1.0.
This commit is contained in:
parent
3f49dc2248
commit
0fa531c613
7
CHANGELOG.md
Normal file
7
CHANGELOG.md
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
# Description of releases
|
||||||
|
## 1.1.0 (04-06-2017)
|
||||||
|
|
||||||
|
Features:
|
||||||
|
- Switch to `npm@5.0.1`.
|
||||||
|
- Switch to `node@8.0`.
|
||||||
|
- Laconic and concise description.
|
44
README.md
44
README.md
@ -8,8 +8,7 @@ Simple API for communicating with the bot of the \"iii.ru\" service.
|
|||||||
## Features
|
## Features
|
||||||
- A small and light library.
|
- A small and light library.
|
||||||
- Receiving and sending messages.
|
- Receiving and sending messages.
|
||||||
- Create sessions, support for any available.
|
- Installation and processing of sessions.
|
||||||
- Independent of the session or bot.
|
|
||||||
|
|
||||||
## Installation
|
## Installation
|
||||||
```bash
|
```bash
|
||||||
@ -17,51 +16,26 @@ npm install --save iii-client
|
|||||||
```
|
```
|
||||||
|
|
||||||
## Using
|
## Using
|
||||||
To use the library, you need to know the bot ID.
|
To use the bot will require identification number. The bot address can be of two kinds: `http://iii.ru/inf/109cd867-0ef3-4473-af71-7543a9b2fccd` and `http://109cd867-0ef3-4473-af71-7543a9b2fccd.iii.ru/`. In the address line, the value `109cd867-0ef3-4473-af71-7543a9b2fccd` is the bot identification number.
|
||||||
It's easy to learn it, you need to go to the home address of a particular bot.
|
|
||||||
The address is as follows `http://iii.ru/inf/109cd867-0ef3-4473-af71-7543a9b2fccd`.
|
|
||||||
The value `109cd867-0ef3-4473-af71-7543a9b2fccd` and is the required parameter.
|
|
||||||
|
|
||||||
Initial connection with the bot:
|
An example of a connection, receiving session identification and sending a bot message:
|
||||||
```javascript
|
```javascript
|
||||||
var bot = require('iii-client');
|
import bot from 'iii-client';
|
||||||
|
|
||||||
var uuid = '109cd867-0ef3-4473-af71-7543a9b2fccd';
|
var uuid = '109cd867-0ef3-4473-af71-7543a9b2fccd';
|
||||||
|
|
||||||
|
// We connect to the system and get a session
|
||||||
bot.connect(uuid, function(data) {
|
bot.connect(uuid, function(data) {
|
||||||
// code...
|
|
||||||
});
|
|
||||||
```
|
|
||||||
|
|
||||||
The answer is as follows:
|
|
||||||
```javascript
|
|
||||||
{
|
|
||||||
cuid: '6791728a-263d-4bc8-9f7f-622856eb55ff',
|
|
||||||
text: {
|
|
||||||
// Lots of text...
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
The value of `cuid` is a session identifier and should be specified when sending a message:
|
|
||||||
```javascript
|
|
||||||
const options = {
|
const options = {
|
||||||
cuid: '6791728a-263d-4bc8-9f7f-622856eb55ff',
|
cuid: data.cuid,
|
||||||
text: 'Проверка связи. Ты получил моё сообщение?',
|
text: 'Проверка связи. Ты получил моё сообщение?',
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Send the message and process the response
|
||||||
bot.send(options, function(raw) {
|
bot.send(options, function(raw) {
|
||||||
/// code...
|
console.log(raw);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
```
|
|
||||||
|
|
||||||
As a result, you will receive an answer:
|
|
||||||
```javascript
|
|
||||||
{
|
|
||||||
result: {
|
|
||||||
text: {
|
|
||||||
value: 'Открой ближайшую к тебе книжку на 30-й странице и перепечатай 13-ю строчку сверху.',
|
|
||||||
// Lots of text...
|
|
||||||
}
|
|
||||||
```
|
```
|
||||||
|
|
||||||
Enjoy!
|
Enjoy!
|
||||||
|
@ -1635,7 +1635,7 @@
|
|||||||
<br class="clear">
|
<br class="clear">
|
||||||
|
|
||||||
<footer>
|
<footer>
|
||||||
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.3</a> on Tue May 30 2017 16:03:16 GMT+0300 (MSK) using the Minami theme.
|
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.3</a> on Sun Jun 04 2017 19:03:12 GMT+0000 (UTC) using the Minami theme.
|
||||||
</footer>
|
</footer>
|
||||||
|
|
||||||
<script>prettyPrint();</script>
|
<script>prettyPrint();</script>
|
||||||
|
@ -57,7 +57,7 @@
|
|||||||
<br class="clear">
|
<br class="clear">
|
||||||
|
|
||||||
<footer>
|
<footer>
|
||||||
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.3</a> on Tue May 30 2017 16:03:16 GMT+0300 (MSK) using the Minami theme.
|
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.3</a> on Sun Jun 04 2017 19:03:12 GMT+0000 (UTC) using the Minami theme.
|
||||||
</footer>
|
</footer>
|
||||||
|
|
||||||
<script>prettyPrint();</script>
|
<script>prettyPrint();</script>
|
||||||
|
@ -219,7 +219,7 @@ function isVerification(data) {
|
|||||||
<br class="clear">
|
<br class="clear">
|
||||||
|
|
||||||
<footer>
|
<footer>
|
||||||
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.3</a> on Tue May 30 2017 16:03:16 GMT+0300 (MSK) using the Minami theme.
|
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.3</a> on Sun Jun 04 2017 19:03:12 GMT+0000 (UTC) using the Minami theme.
|
||||||
</footer>
|
</footer>
|
||||||
|
|
||||||
<script>prettyPrint();</script>
|
<script>prettyPrint();</script>
|
||||||
|
2378
package-lock.json
generated
Normal file
2378
package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load Diff
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "iii-client",
|
"name": "iii-client",
|
||||||
"version": "1.0.0",
|
"version": "1.1.0",
|
||||||
"description": "Simple API for communicating with the bot of the \"iii.ru\" service.",
|
"description": "Simple API for communicating with the bot of the \"iii.ru\" service.",
|
||||||
"homepage": "https://github.com/valentineus/iii-client",
|
"homepage": "https://github.com/valentineus/iii-client",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user