Skip to content

ederaleng/drugwars.js

 
 

Repository files navigation

npm npm GitHub license

DrugWars.js

A lightweight JavaScript library for DrugWars

Install

To install DrugWars.js on Node.js, open your terminal and run:

npm install drugwars --save

Usage

var drugwars = require('drugwars');

// Init WebSocket client
var client = new drugwars.Client('wss://api.drugwars.io');

// Subscribe to notifications
client.subscribe(function(err, result) {
  console.log('Subscribe', result);
});

// Subscribe
client.request('subscribe', 'fabien', function(err, result) {
  console.log('Subscribe', err, result);
});

// Get props
client.request('get_props', null, function(err, result) {
  console.log('Props', err, result);
});

// Get prize props
client.request('get_prize_props', null, function(err, result) {
  console.log('Prize props', err, result);
});

// Get user
client.request('get_user', 'fabien', function(err, result) {
  console.log('User', err, result);
});

// Get users
client.request('get_users', { maxDrugProductionRate: 0.1 }, function(err, result) {
  console.log('Users', err, result);
});

// Get fights
client.request('get_fights', 'fabien', function(err, result) {
  console.log('Attack', err, result);
});

// Log in with SteemConnect access token
const token = 'eyJhbGciOiJIUzI...';
client.request('login', token, function(err, result) {
  console.log('Subscribe', err, result);
});

About

A lightweight JavaScript library for DrugWars

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 100.0%