We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent ba51ed0 commit 162e6f4Copy full SHA for 162e6f4
Parsers/BitcoinPrice.js
@@ -0,0 +1,20 @@
1
+/*
2
+activation_example:!bitcoinprice
3
+regex:!bitcoinprice
4
+flags:gmi
5
+*/
6
+
7
+var input = current.text.trim();
8
+if (/!bitcoinprice/i.test(input)) {
9
+ var quote = new sn_ws.RESTMessageV2();
10
+ quote.setEndpoint('https://api.coindesk.com/v1/bpi/currentprice.json');
11
+ quote.setHttpMethod('GET');
12
13
+ var chatResponse = quote.execute();
14
+ var chatResponseBody = JSON.parse(chatResponse.getBody());
15
16
+ if (chatResponseBody && chatResponseBody.length > 0) {
17
+ var bitcoinpriceFormatted = chatResponseBody.bpi.USD.rate;
18
+ new x_snc_slackerbot.Slacker().send_chat(current, 'The current price of one bitcoin is: ' + bitcoinpriceFormatted + '$', false);
19
+ }
20
+}
0 commit comments