0
mirror of https://github.com/valentineus/iii-client.git synced 2025-04-28 01:41:25 +03:00
2017-07-29 04:39:18 +04:00
2017-09-28 17:09:43 +04:00
2017-07-29 04:39:18 +04:00
2017-09-28 17:00:13 +04:00
2017-09-28 21:20:37 +04:00
2017-09-28 21:20:37 +04:00
2017-09-28 21:28:18 +04:00
2017-05-30 16:03:39 +03:00
2017-05-29 01:46:00 +03:00
2017-09-28 21:28:18 +04:00
2017-09-28 21:28:18 +04:00

III Client

npm

Simple API for communicating with the bot of the "iii.ru" service.

Attention! At the moment there are difficulties with the iii.ru service, there is a possibility that the service will not be restored. All information on the company's forum.

Features

  • A small and light library.
  • Receiving and sending messages.
  • Installation and processing of sessions.

Installation

NodeJS:

npm install --save iii-client

Browser:

<script src="https://unpkg.com/iii-client@latest/dist/bundle.js">
    /* client - This is the global name for accessing the package */
</script>

Using

An example of a connection, receiving session identification and sending a bot message:

import client from 'iii-client';

const uuid = '109cd867-0ef3-4473-af71-7543a9b2fccd';
const text = 'Hello, World!';

// We connect to the system and get a session
client.connect(uuid).then(session => {
    // Send the message and process the response
    client.send(session.cuid, text).then(answer => {
        console.info(answer);
    });
}).catch(error => console.error(error.message));

API

Functions

connect(uuid)

Connects to the server and returns the connection data.

Promise: Object Answer from the server.

Rejects: Error If there are errors in operation.

Param Type Description
uuid String The bot ID.

send(cuid, text)

Send a message to the server and return a response.

Promise: Object Answer from the server.

Rejects: Error If there are errors in operation.

Param Type Description
cuid String Session identifier.
text String Message text.

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

License

JavaScript Style Guide

MIT. Copyright (c) Valentin Popov.

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