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

III Client

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

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.

Initial connection with the bot:

var bot = require('iii-client');

var uuid = '109cd867-0ef3-4473-af71-7543a9b2fccd';

bot.connect(uuid, function(data) {
    // code...
});

The answer is as follows:

{
    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:

const options = {
    cuid: '6791728a-263d-4bc8-9f7f-622856eb55ff',
    text: 'Проверка связи. Ты получил моё сообщение?',
}

bot.send(options, function(raw) {
    /// code...
});

As a result, you will receive an answer:

{
    result: {
        text: {
            value: 'Открой ближайшую к тебе книжку на 30-й странице и перепечатай 13-ю строчку сверху.',
            // Lots of text...
}

Enjoy!

API

Description of the internal kitchen can be seen on the documentation page.

Found out a mistake or feel a lack of functionality? issues

License

MIT. Copyright (c) Valentin Popov.

Description
Simple API for communicating with the bot of the “iii.ru” service.
Readme 644 KiB
Languages
JavaScript 100%