0
mirror of https://github.com/valentineus/iii-client.git synced 2025-04-28 01:41:25 +03:00
iii-client/README.md

54 lines
2.0 KiB
Markdown
Raw Normal View History

2017-05-29 02:27:03 +03:00
# III Client
2017-05-30 16:03:39 +03:00
[![npm](https://img.shields.io/npm/v/iii-client.svg)](https://www.npmjs.com/package/iii-client)
[![dependencies Status](https://david-dm.org/valentineus/iii-client/status.svg)](https://david-dm.org/valentineus/iii-client)
[![devDependencies Status](https://david-dm.org/valentineus/iii-client/dev-status.svg)](https://david-dm.org/valentineus/iii-client?type=dev)
2017-05-29 01:46:00 +03:00
Simple API for communicating with the bot of the \"iii.ru\" service.
## Features
- A small and light library.
- Receiving and sending messages.
2017-06-04 19:03:38 +00:00
- Installation and processing of sessions.
2017-05-29 01:46:00 +03:00
## Installation
```bash
npm install --save iii-client
```
## Using
2017-06-04 19:03:38 +00:00
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.
2017-05-29 01:46:00 +03:00
2017-06-04 19:03:38 +00:00
An example of a connection, receiving session identification and sending a bot message:
2017-05-29 01:46:00 +03:00
```javascript
2017-06-04 19:03:38 +00:00
import bot from 'iii-client';
2017-05-29 01:46:00 +03:00
var uuid = '109cd867-0ef3-4473-af71-7543a9b2fccd';
2017-06-04 19:03:38 +00:00
// We connect to the system and get a session
2017-05-29 01:46:00 +03:00
bot.connect(uuid, function(data) {
2017-06-04 19:03:38 +00:00
const options = {
cuid: data.cuid,
text: 'Проверка связи. Ты получил моё сообщение?',
}
// Send the message and process the response
bot.send(options, function(raw) {
console.log(raw);
});
2017-05-29 01:46:00 +03:00
});
```
Enjoy!
## API
2017-05-29 01:52:31 +03:00
Description of the internal kitchen can be seen on the [documentation page](https://valentineus.github.io/iii-client/).
2017-05-29 01:46:00 +03:00
Found out a mistake or feel a lack of functionality? [issues](https://github.com/valentineus/iii-client/issues)
2017-06-05 16:38:03 +00:00
## Examples
- [iii-for-vk](https://github.com/valentineus/iii-for-vk) - Bot for social network VK;
2017-05-29 01:46:00 +03:00
## License
2017-05-30 16:03:39 +03:00
[![JavaScript Style Guide](https://cdn.rawgit.com/feross/standard/master/badge.svg)](https://github.com/eslint/eslint)
2017-05-29 07:02:09 +03:00
2017-05-29 01:46:00 +03:00
[MIT](LICENSE.md). Copyright (c) [Valentin Popov](https://valentineus.link/).