ripple in peace

This commit is contained in:
2017-12-24 00:06:34 +01:00
parent 5307018d0a
commit b05cbccf1e

View File

@ -3,22 +3,25 @@ import rp from "request-promise";
const api_url = ({ market, crypto, currency }) => `https://api.cryptowat.ch/markets/${market}/${crypto}${currency}/summary`;
const currencies = {
usd: ({ val }) => `\$${val}`,
usdt: ({ val }) => `\$${val}`,
eur: ({ val }) => `${val}`,
eth: ({ val }) => `${val}Ξ`,
btc: ({ val }) => `${val}฿`,
xmr: ({ val }) => `${val} xmr`
xmr: ({ val }) => `${val} xmr`,
xrp: ({ val }) => `${val} xrp`
};
const markets = {
btc: "coinbase",
eth: "coinbase",
xmr: "bitfinex"
xmr: "bitfinex",
xrp: "poloniex"
};
export default bot => {
bot._trigger.set("coins", new bot.trigger({
call: /^(\.|\/)(btc|eth|xmr)/i,
call: /^(\.|\/)(btc|eth|xmr|xrp)/i,
f: e => {
cryptowat_summary(e.cmd, markets[e.cmd], e.cmd !== "xmr" ? e.args[0] || "eur" : "usd").then(
cryptowat_summary(e.cmd, markets[e.cmd], e.cmd !== "xmr" || e.cmd !== "xrp" ? e.args[0] || "eur" : "usdt").then(
resolve => e.reply(resolve),
reject => e.reply(reject)
);