add all supported currencies from api

This commit is contained in:
MSFTserver 2017-09-27 13:53:11 -07:00
parent b42339e347
commit a4382734ae

View file

@ -2,7 +2,6 @@ var jp = require('jsonpath');
var moment = require('moment');
var numeral = require('numeral');
var request = require('request');
var options = {
defaultCurrency: 'USD',
@ -10,6 +9,26 @@ var options = {
currencies: {
USD: { steps: ['LBCBTC', 'BTCUSD'], format: '$0,0.00' },
GBP: { steps: ['LBCBTC', 'BTCGBP'], format: '£0,0.00' },
AUD: { steps: ['LBCBTC', 'BTCAUD'], format: '$0,0.00' },
BRL: { steps: ['LBCBTC', 'BTCBRL'], format: 'R$0,0.00' },
CAD: { steps: ['LBCBTC', 'BTCCAD'], format: '$0,0.00' },
CHF: { steps: ['LBCBTC', 'BTCCHF'], format: 'CHF 0,0.00' },
CLP: { steps: ['LBCBTC', 'BTCCLP'], format: '$0,0.00' },
CNY: { steps: ['LBCBTC', 'BTCCNY'], format: '¥0,0.00' },
DKK: { steps: ['LBCBTC', 'BTCDKK'], format: 'kr 0,0.00' },
EUR: { steps: ['LBCBTC', 'BTCEUR'], format: '€0,0.00' },
HKD: { steps: ['LBCBTC', 'BTCHKD'], format: '$0,0.00' },
INR: { steps: ['LBCBTC', 'BTCINR'], format: '₹0,0.00' },
ISK: { steps: ['LBCBTC', 'BTCISK'], format: 'kr 0,0.00' },
JPY: { steps: ['LBCBTC', 'BTCJPY'], format: '¥0,0.00' },
KRW: { steps: ['LBCBTC', 'BTCKRW'], format: '₩0,0.00' },
NZD: { steps: ['LBCBTC', 'BTCNZD'], format: '$0,0.00' },
PLN: { steps: ['LBCBTC', 'BTCPLN'], format: 'zł 0,0.00' },
RUB: { steps: ['LBCBTC', 'BTCRUB'], format: 'RUB 0,0.00' },
SEK: { steps: ['LBCBTC', 'BTCSEK'], format: 'kr 0,0.00' },
SGD: { steps: ['LBCBTC', 'BTCSGD'], format: '$0,0.00' },
THB: { steps: ['LBCBTC', 'BTCTHB'], format: '฿0,0.00' },
TWD: { steps: ['LBCBTC', 'BTCTWD'], format: 'NT$0,0.00' },
BTC: { steps: ['LBCBTC'], format: '0,0[.][00000000] BTC' }
},
@ -17,7 +36,27 @@ var options = {
api: {
LBCBTC: { url: 'https://bittrex.com/api/v1.1/public/getticker?market=BTC-LBC', path: '$.result.Bid' },
BTCUSD: { url: 'https://blockchain.info/ticker', path: '$.USD.buy' },
BTCGBP: { url: 'https://blockchain.info/ticker', path: '$.GBP.buy' }
BTCGBP: { url: 'https://blockchain.info/ticker', path: '$.GBP.buy' },
BTCAUD: { url: 'https://blockchain.info/ticker', path: '$.AUD.buy' },
BTCBRL: { url: 'https://blockchain.info/ticker', path: '$.BRL.buy' },
BTCCAD: { url: 'https://blockchain.info/ticker', path: '$.CAD.buy' },
BTCCHF: { url: 'https://blockchain.info/ticker', path: '$.CHF.buy' },
BTCCLP: { url: 'https://blockchain.info/ticker', path: '$.CLP.buy' },
BTCCNY: { url: 'https://blockchain.info/ticker', path: '$.CNY.buy' },
BTCDKK: { url: 'https://blockchain.info/ticker', path: '$.DKK.buy' },
BTCEUR: { url: 'https://blockchain.info/ticker', path: '$.EUR.buy' },
BTCHKD: { url: 'https://blockchain.info/ticker', path: '$.HKD.buy' },
BTCINR: { url: 'https://blockchain.info/ticker', path: '$.INR.buy' },
BTCISK: { url: 'https://blockchain.info/ticker', path: '$.ISK.buy' },
BTCJPY: { url: 'https://blockchain.info/ticker', path: '$.JPY.buy' },
BTCKRW: { url: 'https://blockchain.info/ticker', path: '$.KRW.buy' },
BTCNZD: { url: 'https://blockchain.info/ticker', path: '$.NZD.buy' },
BTCPLN: { url: 'https://blockchain.info/ticker', path: '$.PLN.buy' },
BTCRUB: { url: 'https://blockchain.info/ticker', path: '$.RUB.buy' },
BTCSEK: { url: 'https://blockchain.info/ticker', path: '$.SEK.buy' },
BTCSGD: { url: 'https://blockchain.info/ticker', path: '$.SGD.buy' },
BTCTHB: { url: 'https://blockchain.info/ticker', path: '$.THB.buy' },
BTCTWD: { url: 'https://blockchain.info/ticker', path: '$.TWD.buy' }
},
// display date/time format
@ -87,8 +126,9 @@ function doHelp(bot, channel) {
var message =
'`' + command + '`: show the price of 1 LBC in ' + options.defaultCurrency + '\n' +
'`' + command + ' help`: this message\n' +
'`' + command + ' CURRENCY`: show the price of 1 LBC in CURRENCY. Supported values for CURRENCY are *btc* and *usd* (case-insensitive)\n' +
'`' + command + ' CURRENCY AMOUNT`: show the price of AMOUNT LBC in CURRENCY\n';
'`' + command + ' CURRENCY`: show the price of 1 LBC in CURRENCY. Supported values for CURRENCY are Listed Below\n' +
'`' + command + ' CURRENCY AMOUNT`: show the price of AMOUNT LBC in CURRENCY\n' +
'`Supported Currencies:` *usd*, *gbp*, *eur*, *aud*, *brl*, *cad*, *chf*, *clp*, *cny*, *dkk*, *hkd*, *inr*, *isk*, *jpy*, *krw*, *nzd*, *pln* ,*rub*, *sek*, *sgd*, *thb*, *twd* and *btc* (case-insensitive)';
if (!channel.startsWith("D")) {
message =