Browse Source

btc bot format

push-params
Evan Feenstra 4 years ago
parent
commit
4d583cf031
  1. 6
      api/bots/btc.ts
  2. 6
      dist/api/bots/btc.js
  3. 2
      dist/api/bots/btc.js.map

6
api/bots/btc.ts

@ -35,16 +35,16 @@ export function init() {
}) })
if (!r.ok) return if (!r.ok) return
const j = await r.json() const j = await r.json()
const price = j.data.BTC.quote.USD.price.toFixed(2) const price = '$'+j.data.BTC.quote.USD.price.toFixed(2)
const percentChange24 = j.data.BTC.quote.USD.percent_change_24h const percentChange24 = j.data.BTC.quote.USD.percent_change_24h
const percentChange24String = percentChange24.toFixed(2)+'%' const percentChange24String = percentChange24.toFixed(2)+'%'
const changeColor = percentChange24>0?'#078864':'#7a2d2f' const changeColor = percentChange24>0?'#00c991':'#7a2d2f'
const embed = new Sphinx.MessageEmbed() const embed = new Sphinx.MessageEmbed()
.setAuthor('BitcoinBot') .setAuthor('BitcoinBot')
.setTitle('Bitcoin Price:') .setTitle('Bitcoin Price:')
.addFields([ .addFields([
{ name: 'Price:', value: price, inline:true }, { name: 'Price:', value: price, inline:true },
{ name: '24 Hour Change', value: percentChange24String, inline:true, color:changeColor } { name: '24 Hour Change:', value: percentChange24String, inline:true, color:changeColor }
]) ])
.setThumbnail(botSVG) .setThumbnail(botSVG)
message.channel.send({ embed }) message.channel.send({ embed })

6
dist/api/bots/btc.js

@ -42,16 +42,16 @@ function init() {
if (!r.ok) if (!r.ok)
return; return;
const j = yield r.json(); const j = yield r.json();
const price = j.data.BTC.quote.USD.price.toFixed(2); const price = '$' + j.data.BTC.quote.USD.price.toFixed(2);
const percentChange24 = j.data.BTC.quote.USD.percent_change_24h; const percentChange24 = j.data.BTC.quote.USD.percent_change_24h;
const percentChange24String = percentChange24.toFixed(2) + '%'; const percentChange24String = percentChange24.toFixed(2) + '%';
const changeColor = percentChange24 > 0 ? '#078864' : '#7a2d2f'; const changeColor = percentChange24 > 0 ? '#00c991' : '#7a2d2f';
const embed = new Sphinx.MessageEmbed() const embed = new Sphinx.MessageEmbed()
.setAuthor('BitcoinBot') .setAuthor('BitcoinBot')
.setTitle('Bitcoin Price:') .setTitle('Bitcoin Price:')
.addFields([ .addFields([
{ name: 'Price:', value: price, inline: true }, { name: 'Price:', value: price, inline: true },
{ name: '24 Hour Change', value: percentChange24String, inline: true, color: changeColor } { name: '24 Hour Change:', value: percentChange24String, inline: true, color: changeColor }
]) ])
.setThumbnail(botSVG); .setThumbnail(botSVG);
message.channel.send({ embed }); message.channel.send({ embed });

2
dist/api/bots/btc.js.map

@ -1 +1 @@
{"version":3,"file":"btc.js","sourceRoot":"","sources":["../../../api/bots/btc.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,qCAAoC;AACpC,oDAAoD;AACpD,oCAAmC;AACnC,MAAM,SAAS,GAAG,MAAM,CAAC,QAAQ,CAAA;AAEjC,IAAI,OAAO,GAAG,KAAK,CAAA;AAEnB;;EAEE;AAEF,MAAM,KAAK,GAAG,sCAAsC,CAAA;AACpD,MAAM,GAAG,GAAG,mEAAmE,CAAA;AAE/E,SAAgB,IAAI;IAClB,IAAG,OAAO;QAAE,OAAM;IAClB,OAAO,GAAG,IAAI,CAAA;IAEd,MAAM,MAAM,GAAG,IAAI,MAAM,CAAC,MAAM,EAAE,CAAA;IAClC,MAAM,CAAC,KAAK,CAAC,GAAG,EAAE,qBAAW,CAAC,CAAA;IAE9B,MAAM,CAAC,EAAE,CAAC,SAAS,CAAC,OAAO,EAAE,CAAO,OAAuB,EAAE,EAAE;QAC7D,MAAM,GAAG,GAAG,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAA;QACtC,IAAI,GAAG,CAAC,MAAM,GAAG,CAAC;YAAE,OAAM;QAC1B,IAAI,GAAG,CAAC,CAAC,CAAC,KAAG,MAAM;YAAE,OAAM;QAC3B,MAAM,GAAG,GAAG,GAAG,CAAC,CAAC,CAAC,CAAA;QAElB,QAAQ,GAAG,EAAE;YAEX,KAAK,OAAO;gBACV,OAAO,CAAC,G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