Permalink
Browse files
Rework of patch from metalcamp
From: metalcamp <metalcamp@spamtrap.com>
Date: Thu, 23 Feb 2017 21:08:44 +0100
- Loading branch information...
Showing
with
26 additions
and
1 deletion.
-
+1
−0
Readme.md
-
+13
−0
scripts/servisi.coffee
-
+12
−1
test/servisi.coffee
|
|
@@ -29,6 +29,7 @@ Pomoč: |
|
|
.ac <?> -- for what
|
|
|
.apt <paket> -- Najde pakete po imenu v packages.ubuntu.com
|
|
|
.asku <pojem> -- Išči po askubuntu, če vsebuje !! potem prikaže povezave
|
|
|
+ .btc <valuta> - Izpiše trenutno BTC vrednost na Bitstamp (na voljo USD, EUR)
|
|
|
.ddg -- Vse kar zna https://api.duckduckgo.com/api ali https://api.duckduckgo.com/goodies
|
|
|
.imdb <naslov> -- Dobi osnovne podatke z IMBD
|
|
|
.morje -- Izpiše temperature slovenskega morja (Koper, Debeli rtič ter Piran)
|
|
|
|
|
|
@@ -168,3 +168,16 @@ module.exports = (bot) -> |
|
|
irc.reply "Trenutno se predvaja: #{data.response.BroadcastMonitor.Current.artistName} - #{data.response.BroadcastMonitor.Current.titleName}"
|
|
|
else
|
|
|
irc.reply "OMG val202 is down!"
|
|
|
+
|
|
|
+ bot.regexp /^\.btc (.+)/,
|
|
|
+ ".btc <valuta> - izpiše trenutno BTC vrednost na Bitstamp",
|
|
|
+ (match, r) ->
|
|
|
+ currency = match[1]
|
|
|
+ if currency == "eur" || currency = "usd"
|
|
|
+ bot.fetchJSON "https://www.bitstamp.net/api/v2/ticker/btc#{currency}/", (data) ->
|
|
|
+ if data && ! null
|
|
|
+ r.reply "Vrednost BTC v #{currency.toUpperCase()}: last: #{data.last}, low: #{data.low}, high: #{data.high}, bid: #{data.bid}, ask: #{data.ask}"
|
|
|
+ else
|
|
|
+ r.reply "Bitstamp is down"
|
|
|
+ else
|
|
|
+ r.reply "Napačna valuta"
|
|
|
@@ -87,7 +87,18 @@ describe 'servisi.coffee', -> |
|
|
bot.test ".time ljubljana", (msg) ->
|
|
|
expect(msg).to.be.a('string')
|
|
|
done()
|
|
|
+
|
|
|
it 'test .val', (done)->
|
|
|
bot.test ".val", (msg)->
|
|
|
expect(msg).to.be.a('string')
|
|
|
- done()
|
|
|
+ done()
|
|
|
+
|
|
|
+ it 'test .btc eur', (done)->
|
|
|
+ bot.test ".btc eur", (msg) ->
|
|
|
+ expect(msg).to.be.a('string')
|
|
|
+ done()
|
|
|
+
|
|
|
+ it 'test .btc usd', (done)->
|
|
|
+ bot.test ".btc usd", (msg) ->
|
|
|
+ expect(msg).to.be.a('string')
|
|
|
+ done()
|
0 comments on commit
0fc9759