1.0.0 • Published 8 years ago

teabot-aerospike v1.0.0

Weekly downloads
2
License
MIT
Repository
github
Last release
8 years ago

teabot-aerospike License npm npm

Build Status node Test Coverage bitHound Score

teabot-aerospike an Aerospike db plugin for TeaBot.

By default, all data is stored in memory, but for synchronization between servers or nodes, you can use this plugin.

Usage

$ npm install teabot-aerospike --save

You also should install TeaBot and Aerospike client.

var TeaBot = require('teabot')('TELEGRAM_BOT_TOKEN', 'TELEGRAM_BOT_NAME');
var aerospike = require('aerospike');
var client = aerospike.client({
  hosts: [{
    addr: '127.0.0.1',
    port: 4000,
  }]
}).connect(function(response) {
  if (response.code == 0) {
    console.log('Connection to Aerospike cluster succeeded!');
  }
});

TeaBot.use('db', require('teabot-aerospike')(client));

TeaBot.defineCommand(function(dialog, message) {
  dialog.setUserData('some data', 'data'); // data will be stored at Aerospike db
  dialog.sendMessage('Echo: ' + message.text);
});

TeaBot.startPolling();

License

The MIT License (MIT) Copyright (c) 2016 Alexey Bystrov