mirror of
				https://github.com/valentineus/iii-client.git
				synced 2025-11-04 03:49:44 +03:00 
			
		
		
		
	Release of version 1.1.0.
This commit is contained in:
		
							
								
								
									
										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.
 | 
			
		||||
							
								
								
									
										54
									
								
								README.md
									
									
									
									
									
								
							
							
						
						
									
										54
									
								
								README.md
									
									
									
									
									
								
							@@ -8,8 +8,7 @@ Simple API for communicating with the bot of the \"iii.ru\" service.
 | 
			
		||||
## Features
 | 
			
		||||
- A small and light library.
 | 
			
		||||
- Receiving and sending messages.
 | 
			
		||||
- Create sessions, support for any available.
 | 
			
		||||
- Independent of the session or bot.
 | 
			
		||||
- Installation and processing of sessions.
 | 
			
		||||
 | 
			
		||||
## Installation
 | 
			
		||||
```bash
 | 
			
		||||
@@ -17,53 +16,28 @@ npm install --save iii-client
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
## Using
 | 
			
		||||
To use the library, you need to know the bot ID.
 | 
			
		||||
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.
 | 
			
		||||
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.
 | 
			
		||||
 | 
			
		||||
Initial connection with the bot:
 | 
			
		||||
An example of a connection, receiving session identification and sending a bot message:
 | 
			
		||||
```javascript
 | 
			
		||||
var bot = require('iii-client');
 | 
			
		||||
import bot from 'iii-client';
 | 
			
		||||
 | 
			
		||||
var uuid = '109cd867-0ef3-4473-af71-7543a9b2fccd';
 | 
			
		||||
 | 
			
		||||
// We connect to the system and get a session
 | 
			
		||||
bot.connect(uuid, function(data) {
 | 
			
		||||
    // code...
 | 
			
		||||
    const options = {
 | 
			
		||||
        cuid: data.cuid,
 | 
			
		||||
        text: 'Проверка связи. Ты получил моё сообщение?',
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    // Send the message and process the response
 | 
			
		||||
    bot.send(options, function(raw) {
 | 
			
		||||
        console.log(raw);
 | 
			
		||||
    });
 | 
			
		||||
});
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
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 = {
 | 
			
		||||
    cuid: '6791728a-263d-4bc8-9f7f-622856eb55ff',
 | 
			
		||||
    text: 'Проверка связи. Ты получил моё сообщение?',
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
bot.send(options, function(raw) {
 | 
			
		||||
    /// code...
 | 
			
		||||
});
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
As a result, you will receive an answer:
 | 
			
		||||
```javascript
 | 
			
		||||
{
 | 
			
		||||
    result: {
 | 
			
		||||
        text: {
 | 
			
		||||
            value: 'Открой ближайшую к тебе книжку на 30-й странице и перепечатай 13-ю строчку сверху.',
 | 
			
		||||
            // Lots of text...
 | 
			
		||||
}
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
Enjoy!
 | 
			
		||||
 | 
			
		||||
## API
 | 
			
		||||
 
 | 
			
		||||
@@ -1635,7 +1635,7 @@
 | 
			
		||||
<br class="clear">
 | 
			
		||||
 | 
			
		||||
<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>
 | 
			
		||||
 | 
			
		||||
<script>prettyPrint();</script>
 | 
			
		||||
 
 | 
			
		||||
@@ -57,7 +57,7 @@
 | 
			
		||||
<br class="clear">
 | 
			
		||||
 | 
			
		||||
<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>
 | 
			
		||||
 | 
			
		||||
<script>prettyPrint();</script>
 | 
			
		||||
 
 | 
			
		||||
@@ -219,7 +219,7 @@ function isVerification(data) {
 | 
			
		||||
<br class="clear">
 | 
			
		||||
 | 
			
		||||
<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>
 | 
			
		||||
 | 
			
		||||
<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",
 | 
			
		||||
  "version": "1.0.0",
 | 
			
		||||
  "version": "1.1.0",
 | 
			
		||||
  "description": "Simple API for communicating with the bot of the \"iii.ru\" service.",
 | 
			
		||||
  "homepage": "https://github.com/valentineus/iii-client",
 | 
			
		||||
  "license": "MIT",
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user