0.2.0 • Published 9 years ago

primedice v0.2.0

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

Node Primedice Build Status

Node.js library for accessing Primedice's API

Instalation

Install with the Node.js package manager npm:

npm install --save primedice

API

Primedice(accessToken:String)

Initialize a new Primedice with the given accessToken

Example:

var Primedice = require('Primedice');
var accessToken = 'abc123';

var client1 = new Primedice(accessToken);

//Can only execute operations that doesn't require authentication
var client2 = new Primedice();

Primedice.users(userName:String, callback:Function)

Get your own info or a user's info with the given username

Examples:

userName's info

 Primedice.users('userName', function(error, response) {
   if (!err) console.log(response);
 });

Your own info

 Primedice.users(function(error, response) {
   if (!err) console.log(response);
 });

Primedice.deposit(callback:Function)

Get your deposit address

Example:

 Primedice.deposit(function(error, response) {
   if (!err) console.log(response);
 });

Primedice.deposits(callback:Function)

Get your deposits

Example:

 Primedice.deposits(function(error, response) {
   if (!err) console.log(response);
 });

Primedice.withdraw(amount:Number, address:String, callback:Function)

Withdraw an amount

Example:

 //withdraw 100000 (10000 is the transaction fee)
 Primedice.withdraw(110000, 'My81tc01N4dDr355', function(error, response) {
   if (!err) console.log(response);
 });

Primedice.withdrawals(callback:Function)

Get your withdrawals

Example:

 Primedice.withdrawals(function(error, response) {
   if (!err) console.log(response);
 });

Primedice.bet(amount:Number, target:Number, condition:String, callback:Function)

Make a bet

Example:

 //for a bet of 0.00000010 with 2x Payout (Roll under 49.5 to win)
 Primedice.bet(10, 49.5, '<', function(error, response) {
   if (!err) console.log(response);
 });

Primedice.seed(seed:String, callback:Function)

Change your seed

Example:

 Primedice.seed('533D', function(error, response) {
   if (!err) console.log(response);
 });

Primedice.mybets(callback:Function)

Get your last 30 bets

Example:

 Primedice.mybets(function(error, response) {
   if (!err) console.log(response);
 });

Primedice.bets(BetID:Number, callback:Function)

Get last 30 bets of the site or lookup a bet id

Examples:

30 bets of the site

 Primedice.bets(function(error, response) {
   if (!err) console.log(response);
 });

lookup a bet id

 Primedice.bets(4800000000, (error, response) {
   if (!err) console.log(response);
 });

Primedice.send(room:String, message:String, toUsername:String, callback:Function)

Send a message to a chat room or a PM to a specific user

Examples:

Send a message to the english chat room

 Primedice.send("English", "Hello World!", function(error, response) {
   if (!err) console.log(response);
 });

Send a message to user Visions

 Primedice.send("English", "Hello World!", "Visions", function(error, response) {
   if (!err) console.log(response);
 });

Primedice.rooms(callback:Function)

Get list of rooms

Example:

 Primedice.rooms(function(error, response) {
   if (!err) console.log(response);
 });

Primedice.messages(room:String, callback:Function)

Get chat messages from a room

Examples:

No room (defaults to English room)

 Primedice.messages(function(error, response) {
   if (!err) console.log(response);
 });

Specific room

 Primedice.messages('PVP', function(error, response) {
   if (!err) console.log(response);
 });

Primedice.allmessages(callback:Function)

Get chat messages from all available rooms

Example:

 Primedice.allmesages(function(error, response) {
   if (!err) console.log(response);
 });

##License

MIT

0.2.0

9 years ago

0.1.2

9 years ago

0.1.0

9 years ago