diff --git a/.gitignore b/.gitignore index 8ac217a..9d90a83 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ client.py *.pyc +apikey.py diff --git a/price.py b/price.py index 7d3cf3d..55f3c0f 100644 --- a/price.py +++ b/price.py @@ -3,6 +3,7 @@ import sopel.module import requests import time import random +# from apikey import commodity_key polourl = "https://poloniex.com/public?command=returnTicker" poloxmrlendurl = "https://poloniex.com/public?command=returnLoanOrders¤cy=XMR&limit=999999" @@ -20,6 +21,7 @@ krakusd = 'https://api.kraken.com/0/public/Ticker?pair=XMRUSD' krakeur = 'https://api.kraken.com/0/public/Ticker?pair=XMREUR' okcquar = 'https://www.okcoin.com/api/v1/future_ticker.do?symbol=btc_usd&contract_type=quarter' krakusdt = 'http://api.kraken.com/0/public/Ticker?pair=USDTUSD' +bitflyerurl = 'https://api.bitflyer.jp/v1/ticker' @sopel.module.commands('bfx', 'bitfinex') def bfx(bot, trigger): @@ -175,6 +177,28 @@ def lending(bot, trigger): except: bot.say("Something bad happened :o") +@sopel.module.commands('btclending') +def btclending(bot, trigger): + try: + r=requests.get(polobtclendurl) + j=r.json() + amnt=0 + amnt10=0 + rate10=0 + amnt100=0 + rate100=0 + for i in j['offers']: + if amnt < 10: + amnt10=amnt + rate10=float(i['rate']) + if amnt < 100: + amnt100=amnt + rate100=float(i['rate']) + amnt+=float(i['amount']) + bot.say("Minimum rate is {0:.3f}%. To borrow {1:,.2f} BTC need up to rate {2:.3f}%. To borrow {3:,.2f} BTC need up to rate {4:.3f}%. Total amount is {5:,.2f} BTC at max rate {6:.3f}%".format(float(j['offers'][0]['rate'])*100, amnt10, rate10*100, amnt100, rate100*100, amnt, float(j['offers'][-1]['rate'])*100)) + except: + bot.say("Something bad happened :o") + @sopel.module.commands('trex', 'bittrex') def trex(bot, trigger): @@ -345,13 +369,15 @@ def tall(bot, trigger): btccurl = 'https://data.btcchina.com/data/ticker?market=btccny' huobiurl = 'http://api.huobi.com/staticmarket/ticker_btc_json.js' gemiurl = 'https://api.gemini.com/v1/pubticker/btcusd' - gdaxurl = 'https://api.coinbase.com/v2/exchange-rates?currency=BTC' + # gdaxurl = 'https://api.coinbase.com/v2/exchange-rates?currency=BTC' + gdaxurl = 'https://api.gdax.com/products/BTC-USD/ticker' # Get conversion rate try: fixerresult = requests.get(fixerurl) fixerjson = fixerresult.json() usdcny = fixerjson['rates']['CNY'] usdeur = fixerjson['rates']['EUR'] + usdjpy = fixerjson['rates']['JPY'] except: usdcny = 7 # Bitstamp @@ -388,7 +414,7 @@ def tall(bot, trigger): except: gdaxjson = False if gdaxjson: - stringtosend += "GDAX price: {0:,.2f} | ".format(float(gdaxjson['data']['rates']['USD'])) + stringtosend += "GDAX price: {0:,.2f}, vol: {1:,.1f} | ".format(float(gdaxjson['price']), float(gdaxjson['volume'])) # Bitfinex try: finexresult = requests.get(finexurl) @@ -413,6 +439,14 @@ def tall(bot, trigger): huobijson = False if huobijson: stringtosend += "Huobi last: {0:,.2f}, vol: {1:,.1f} | ".format(float(huobijson['ticker']['last'])/usdcny, float(huobijson['ticker']['vol'])) + # Bitflyer + try: + bitflyerresult = requests.get(bitflyerurl) + bitflyerjson = bitflyerresult.json() + except: + bitflyerjson = False + if bitflyerjson: + stringtosend += "Bitflyer last: {0:,.2f}, vol: {1:,.1f} | ".format(float(bitflyerjson['ltp'])/usdjpy, float(bitflyerjson['volume_by_product'])) # Send the tickers to IRC bot.say(stringtosend) @@ -635,3 +669,28 @@ def price(bot, trigger): bot.say("1 XMR = $1000 USD (Offer valid in participating locations)") except: bot.say("C-cex sucks") + +@sopel.module.commands('commodity', 'com') +def commodity(bot, trigger): + commodity_key = 'B1ZnykTmG6_A1vkwzt9u' + input_com = trigger.group(2).upper() + if input_com == ('AU' or 'GOLD' or 'XAU'): + commodity = 'AU_EGL' + unit = 'oz' + elif input_com == ('AG' or 'SILVER' or 'XAG'): + commodity = 'AG_USD' + unit = 'oz' + elif input_com == ('PT' or 'PLATINUM' or 'XPT'): + commodity = 'WLD_PLATINUM' + unit = 'oz' + elif input_com == ('COFFEE'): + commodity = 'COFFEE_BRZL' + unit = 'lb' + try: + r=requests.get("https://www.quandl.com/api/v3/datasets/COM/{0}.json?&api_key={1}".format(commodity, commodity_key)) + j=r.json() + last=j['dataset']['data'][0][1] + bot.say("Last price on {0} was ${1:.3f} per {2}.".format(commodity, last, unit)) + except: + bot.say("Monerobux fails again...") + diff --git a/trifling.py b/trifling.py index e6e3d7f..637ce89 100644 --- a/trifling.py +++ b/trifling.py @@ -5,6 +5,7 @@ import re import requests import praw from client import * +from threading import Timer @sopel.module.commands('4matter') def fourmatter(bot, trigger): @@ -131,6 +132,15 @@ def gay(bot, trigger): def gui(bot, trigger): bot.say('http://imgur.com/a/hnxfS') +hitleroptions = [ +'https://www.youtube.com/watch?v=L2WfedZG7bo', +r"There's always Aeon", +'http://adolfcoin.camp/' +] +@sopel.module.commands('hitler', 'adolf') +def hitler(bot, trigger): + bot.say(random.choice(hitleroptions)) + @sopel.module.commands('hmm', 'hmmm') def hmm(bot, trigger): # try: @@ -182,10 +192,18 @@ def kid(bot, trigger): def lenny(bot, trigger): bot.say(u'( ͡° ͜ʖ ͡°)'.encode('utf8')) +@sopel.module.commands('luigi') +def luigi(bot, trigger): + bot.say(u'🍄 luigi is doing. mario is not doing luigi is doing 🍄'.encode('utf8')) + @sopel.module.commands('ltc', 'chikun') def ltc(bot, trigger): bot.say(u'🐔🐔🐔 https://cdn.meme.am/cache/instances/folder100/48222100.jpg 🐔🐔🐔'.encode('utf8')) +@sopel.module.commands('major') +def major(bot, trigger): + bot.say(r"Showed them a sneak peak of the MAJOR Monero announcement that is happening at tomorrow's meetup, they're excited!") + @sopel.module.commands('masternode', 'masternodes') def masternode(bot, trigger): bot.say('http://hadoopilluminated.com/hadoop_illuminated/images/hdfs3.jpg') @@ -198,6 +216,18 @@ def moon(bot, trigger): def multisig(bot, trigger): bot.say(u'𝓼𝓲𝓰𝓷𝓪𝓽𝓾𝓻𝓮 𝓼𝓲𝓰𝓷𝓪𝓽𝓾𝓻𝓮'.encode('utf8')) +@sopel.module.commands('myriad', 'myr', 'myriadcoin') +def myriad(bot, trigger): + bot.say(u'Myriad - A coin for everyone 🖐'.encode('utf8')) + +@sopel.module.commands('needmoney', 'needmoney90', 'nm90') +def needmoney(bot, trigger): + bot.say(u'cash rules everything around me C.R.E.A.M get the money 💵 💵 bill yall'.encode('utf8')) + +@sopel.module.commands('nioc') +def nioc(bot, trigger): + bot.say(u'If I had a monero for every time I went to the salt mines...I would have a lot of moneros'.encode('utf8')) + @sopel.module.commands('nomnomnom') def nomnomnom(bot, trigger): bot.say(u'ᗧ•••ᗣ'.encode('utf8')) @@ -213,7 +243,7 @@ odboptions = [ ] @sopel.module.commands('odb', 'oldirty') def odb(bot, trigger): - bot.say(random.choice(confirmoptions)) + bot.say(random.choice(odboptions)) perooptions = [ 'https://www.youtube.com/watch?v=QqreRufrkxM', @@ -300,6 +330,27 @@ def summon(bot, trigger): def timetravelpp(bot, trigger): bot.say("A journey is best measured in pepes, rather than miles http://rarepepedirectory.com/wp-content/uploads/2016/09/timetravelpepe.jpg") +@sopel.module.commands('trivia') +def trivia(bot, trigger): + try: + triviaurl = 'https://opentdb.com/api.php?amount=1&type=multiple' + r = requests.get(triviaurl) + j = r.json() + category = j['results'][0]['category'] + difficulty = j['results'][0]['difficulty'] + question = j['results'][0]['question'] + correct_answer = j['results'][0]['correct_answer'] + incorrect_answers = j['results'][0]['incorrect_answers'] + bot.say("This question is in the field of {} and is of {} difficulty: {}".format(category, difficulty, question)) + replystr = "If you said {} you are correct, but if you said {}, {}, or {} you should call your parents and complain.".format(correct_answer, incorrect_answers[0], incorrect_answers[1], incorrect_answers[2]) + def f(): + bot.say(replystr) + t = Timer(10.0, f) + t.start() + except: + bot.say("No trivia for you!") + + reddit=praw.Reddit(client_id=client_id, client_secret=client_secret, user_agent='monerobux', @@ -372,6 +423,10 @@ zcashoptions = [ def zcash(bot, trigger): bot.say(random.choice(zcashoptions)) +@sopel.module.commands('zooko') +def zcash(bot, trigger): + bot.say("And by the way, I think we can successfully make Zcash too traceable for criminals like WannaCry, but still completely private & fungible.") + @sopel.module.rule('monerobux o\/') def wave(bot, trigger): #bot.reply(u'‹^› ‹(•_•)› ‹^›'.encode('utf8'))