diff --git a/api/bots/btc.ts b/api/bots/btc.ts index ba2ec52..d830e58 100644 --- a/api/bots/btc.ts +++ b/api/bots/btc.ts @@ -36,13 +36,15 @@ export function init() { if (!r.ok) return const j = await r.json() const price = j.data.BTC.quote.USD.price.toFixed(2) - const percentChange24 = j.data.BTC.quote.USD.percent_change_24h.toFixed(2) + const percentChange24 = j.data.BTC.quote.USD.percent_change_24h + const percentChange24String = percentChange24.toFixed(2)+'%' + const changeColor = percentChange24>0?'#078864':'#7a2d2f' const embed = new Sphinx.MessageEmbed() .setAuthor('BitcoinBot') .setTitle('Bitcoin Price:') .addFields([ - { name: 'Price:', value: price }, - { name: '24 Hour Change', value: percentChange24+'%' } + { name: 'Price:', value: price, inline:true }, + { name: '24 Hour Change', value: percentChange24String, inline:true, color:changeColor } ]) .setThumbnail(botSVG) message.channel.send({ embed }) diff --git a/dist/api/bots/btc.js b/dist/api/bots/btc.js index 4ca083d..f92aa06 100644 --- a/dist/api/bots/btc.js +++ b/dist/api/bots/btc.js @@ -43,13 +43,15 @@ function init() { return; const j = yield r.json(); const price = j.data.BTC.quote.USD.price.toFixed(2); - const percentChange24 = j.data.BTC.quote.USD.percent_change_24h.toFixed(2); + const percentChange24 = j.data.BTC.quote.USD.percent_change_24h; + const percentChange24String = percentChange24.toFixed(2) + '%'; + const changeColor = percentChange24 > 0 ? '#078864' : '#7a2d2f'; const embed = new Sphinx.MessageEmbed() .setAuthor('BitcoinBot') .setTitle('Bitcoin Price:') .addFields([ - { name: 'Price:', value: price }, - { name: '24 Hour Change', value: percentChange24 + '%' } + { name: 'Price:', value: price, inline: true }, + { name: '24 Hour Change', value: percentChange24String, inline: true, color: changeColor } ]) .setThumbnail(botSVG); message.channel.send({ embed }); diff --git a/dist/api/bots/btc.js.map b/dist/api/bots/btc.js.map index 81126df..f15d235 100644 --- a/dist/api/bots/btc.js.map +++ b/dist/api/bots/btc.js.map @@ -1 +1 @@ -{"version":3,"file":"btc.js","sourceRoot":"","sources":["../../../api/bots/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BAChD,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,WAAW,EAAE;iBACrC,CAAC;qBACD,YAAY,CAAC,MAAM,CAAC,CAAA;gBACvB,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,CAAC,CAAA;gBAC/B,OAAM;SACT;IACH,CAAC,CAAA,CAAC,CAAA;AACJ,CAAC;AAtDD,oBAsDC;AAED,MAAM,MAAM,GAAG;;OAER,CAAA"} \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index 6db1489..efdfb08 100644 --- a/package-lock.json +++ b/package-lock.json @@ -11203,9 +11203,9 @@ } }, "sphinx-bot": { - "version": "0.1.26", - "resolved": "https://registry.npmjs.org/sphinx-bot/-/sphinx-bot-0.1.26.tgz", - "integrity": "sha512-Tb9uOLcvQhYugNOjFL1wwgdtU1sBVHuXE0hJEXAkyymQolksdHufkgdfQAbJEJnHbV1GiF1WKvkgEnB6LPT7fQ==", + "version": "0.1.27", + "resolved": "https://registry.npmjs.org/sphinx-bot/-/sphinx-bot-0.1.27.tgz", + "integrity": "sha512-qGzcfjPiu2OFggaQUDVdlu4h1Mfur+lLI0Bo0dcgy9HLVOYSotOkGKtKPAPutsKuVK9mkxHj/wfc/CK0p8S1Dw==", "requires": { "eventemitter3": "^4.0.7", "isomorphic-dompurify": "^0.6.0" diff --git a/package.json b/package.json index 2b8484f..dca5adb 100644 --- a/package.json +++ b/package.json @@ -78,7 +78,7 @@ "short-uuid": "^3.1.1", "sjcl": "^1.0.8", "socket.io": "^2.3.0", - "sphinx-bot": "^0.1.26", + "sphinx-bot": "^0.1.27", "tail": "^2.0.3", "ts-node": "^8.5.4", "tsc": "^1.20150623.0",