Node.js library for accessing Primedice's API
Install with the Node.js package manager npm:
npm install --save primedice
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();
Get your own info or a user's info with the given username
Examples:
userName's info
Primedice.users('userName', function(error, response) {
if (!error) console.log(response);
});
Your own info
Primedice.users(function(error, response) {
if (!error) console.log(response);
});
Get your deposit address
Example:
Primedice.deposit(function(error, response) {
if (!error) console.log(response);
});
Get your deposits
Example:
Primedice.deposits(function(error, response) {
if (!error) console.log(response);
});
Withdraw an amount
Example:
//withdraw 100000 (10000 is the transaction fee)
Primedice.withdraw(110000, 'My81tc01N4dDr355', function(error, response) {
if (!error) console.log(response);
});
Get your withdrawals
Example:
Primedice.withdrawals(function(error, response) {
if (!error) console.log(response);
});
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 (!error) console.log(response);
});
Change your seed
Example:
Primedice.seed('533D', function(error, response) {
if (!error) console.log(response);
});
Get your last 30 bets
Example:
Primedice.mybets(function(error, response) {
if (!error) console.log(response);
});
Get last 30 bets of the site or lookup a bet id
Examples:
30 bets of the site
Primedice.bets(function(error, response) {
if (!error) console.log(response);
});
lookup a bet id
Primedice.bets(4800000000, (error, response) {
if (!error) console.log(response);
});
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 (!error) console.log(response);
});
Send a message to user Visions
Primedice.send("English", "Hello World!", "Visions", function(error, response) {
if (!error) console.log(response);
});
Get list of rooms
Example:
Primedice.rooms(function(error, response) {
if (!error) console.log(response);
});
Get chat messages from a room
Examples:
No room (defaults to English room)
Primedice.messages(function(error, response) {
if (!error) console.log(response);
});
Specific room
Primedice.messages('PVP', function(error, response) {
if (!error) console.log(response);
});
Get chat messages from all available rooms
Example:
Primedice.allmesages(function(error, response) {
if (!error) console.log(response);
});
##License
MIT