Current Crypto-Currency Price -mIRC script-

By rebel9 on May 31, 2017

Displays the current price of BTC/ETH/LTC/PPC. Works with SReject's JSONForMirc

UPDATE: BTC/ETH - Added the highs and lows for a 24 hour span.

Usage - (user): !coins
Example - (bot): (Coins) Bitcoin (BTC): 2410.8 [High:2465.92] [Low:2306.86] Ethereum (ETH): 221.47 [High:236.5] [Low:206.51] Litecoin (LTC): 27.65 Peercoin (PPC): 1.56

Coded by bongrip. - irc.zerosec.net +6697 #insecurity

alias coins {
  JSONOpen -u coin https://min-api.cryptocompare.com/data/pricemultifull?fsyms=BTC,ETH,PPC,LTC&tsyms=USD,EUR
  var %BTC:USD = $round($JSON(coin, RAW, BTC, USD, PRICE).value, 2)
  var %ETH:USD = $round($JSON(coin, RAW, ETH, USD, PRICE).value, 2)
  var %LTC:USD = $round($JSON(coin, RAW, LTC, USD, PRICE).value, 2)
  var %PPC:USD = $round($JSON(coin, RAW, PPC, USD, PRICE).value, 2)
  var %high:btc = $round($JSON(coin, RAW, BTC, USD, HIGH24HOUR).value, 2)
  var %low:btc = $round($JSON(coin, RAW, BTC, USD, LOW24HOUR).value, 2)
  var %high:eth = $round($JSON(coin, RAW, ETH, USD, HIGH24HOUR).value, 2)
  var %low:eth = $round($JSON(coin, RAW, ETH, USD, LOW24HOUR).value, 2)
  JSONClose coin
  return 14(Coins14) Bitcoin (BTC):12 %BTC:USD $+(,$chr(91),9H,3,igh:,%high:btc,$chr(93)) $+(,$chr(91),4L,5,ow:,%low:btc,$chr(93)) Ethereum (ETH):12 %ETH:USD $+(,$chr(91),9H,3,igh:,%high:eth,$chr(93)) $+(,$chr(91),4L,5,ow:,%low:eth,$chr(93))  Litecoin (LTC):12 %LTC:USD Peercoin (PPC):12 %PPC:USD 
}

on $*:text:/^[!@.](coins)( |$)/iS:#:{
  if (!%fud && !$($+(%, fud., $nick), 2)) {
    set -u3 %fud On
    set -u10 %fud. $+ $nick On
    msg $chan $left($replace($coins, $crlf, $chr(32), $cr, $chr(32), $lf, $chr(32)), 250)
  }
}

Comments

Sign in to comment.
ovelayer   -  Jun 01, 2017

awsome...
could you please provide a link to the json version you used...
the one by sreject was moved to github and that version does not work with this script...
thanks =)

rebel9  -  Jun 01, 2017

https://thepasteb.in/p/mwhKc9q4Ljm26Im The latest version, beta. I updated from a very old version of JSON (i think it was v0.2.2) and mIRC so it's now updated, that's why $round is there. if it still doesnt work, come to that IRC, I'll help you out because I want this to work the first time for everyone....because it weirdly works for me on both old version and new.

ovelayer  -  Jun 01, 2017

still cant get it to work..
maybe put this script with the json included at the bottom..so it's all 1 script...
i dont see a chan info to join and ask my questions there...but with the jason you gave me i tried it 2 ways...
made the json a seperate .mrc file and loaded it....---failed
added the json to the bottom of this script...---failed
would like to see this work if possible...
thanks!!

rebel9  -  Jun 01, 2017

Updated to newest JSON, had to define .value as SReject has shown.

SReject  -  Jun 01, 2017

@ovelayer the following has been altered to work with the latest version of my json parser(1.0.3x; the one on github); though I haven't tested it:

disregard; the author has updated the above script to work with the latest JFM version

ovelayer  -  Jun 02, 2017

k updated the coin script incase of changes updated the json to the latest rc build on github...
i still get 0 results...
does json work in a vm enviorment? i know it doesnt in wine...
my bot runs on vm... is this the problem?
i am running mirc 7.49

rebel9  -  Jun 02, 2017

Example of it working on my server right now with all the latest :
(~user) !coins
(&bot) (Coins) Bitcoin (BTC): 2397.52 [High:2464.52] [Low:2320.84] Ethereum (ETH): 219.38 [High:228.24] [Low:206.52] Litecoin (LTC): 27.2 Peercoin (PPC): 1.55

rebel9  -  Jun 02, 2017

Also, try removing:

on $*:text:/^[!@.](coins)( |$)/iS:#:{

And add:

on $*:text:!coins:#: {
Sign in to comment

Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.