Initial commit
This commit is contained in:
commit
9746b52881
|
@ -0,0 +1,47 @@
|
|||
import sopel.module
|
||||
import requests
|
||||
import re
|
||||
|
||||
networkurl = "http://api.minexmr.com:8080/stats"
|
||||
|
||||
@sopel.module.commands('network')
|
||||
def network(bot, trigger):
|
||||
try:
|
||||
r=requests.get(networkurl)
|
||||
j=r.json()
|
||||
except Exception,e:
|
||||
pass
|
||||
try:
|
||||
height=j["network"]["height"]
|
||||
diff=j["network"]["difficulty"]
|
||||
hashrate=float(diff)/120
|
||||
bot.say("The current block height is {0:,}. Difficulty is {1:,}. Hashrate is {2:.2f} Mh/s.".format(height,diff,hashrate/1e6))
|
||||
except:
|
||||
bot.say("Something borked -_-")
|
||||
|
||||
@sopel.module.commands('btcmempool')
|
||||
def btcmempool(bot, trigger):
|
||||
try:
|
||||
r=requests.get('https://blockchain.info/q/unconfirmedcount')
|
||||
bot.say("The current number of txs in Bitcoin's mempool is {0}".format(r.text))
|
||||
except:
|
||||
bot.say("Fuck you, and fuck Bitcoin too")
|
||||
|
||||
@sopel.module.commands('mempool')
|
||||
def mempool(bot, trigger):
|
||||
try:
|
||||
# r=requests.get('http://node.moneroworld.com:18081/getinfo')
|
||||
r=requests.get('http://node.xmrbackb.one:18081/getinfo')
|
||||
j=r.json()
|
||||
bot.say("The current number of txs in Monero's mempool is {0}".format(j['tx_pool_size']))
|
||||
except:
|
||||
bot.say("Something borked o_O")
|
||||
|
||||
@sopel.module.commands('blocksize')
|
||||
def blocksize(bot, trigger):
|
||||
try:
|
||||
r=requests.get('http://moneroblocks.info/stats/block-medians')
|
||||
size=re.search(' <\/strong><\/div>\s*<div class=\"col-xs-5 col-sm-3 col-md-1\">(\d*)', r.text)
|
||||
bot.say("Median blocksize over last 200 blocks is {0} bytes".format(size.group(1)))
|
||||
except:
|
||||
bot.say("Bomething sorked 0_0")
|
|
@ -0,0 +1,568 @@
|
|||
#romerito -*- coding: UTF-8 -*-
|
||||
import sopel.module
|
||||
import requests
|
||||
import time
|
||||
|
||||
polourl = "https://poloniex.com/public?command=returnTicker"
|
||||
poloxmrlendurl = "https://poloniex.com/public?command=returnLoanOrders¤cy=XMR&limit=999999"
|
||||
prevamnt, prevtime = 0, 0
|
||||
trexurl = "https://bittrex.com/api/v1.1/public/getmarketsummary?market=btc-"
|
||||
cryptopiaurl = "https://www.cryptopia.co.nz/api/GetMarket/2999"
|
||||
bitsquareurl = "https://market.bitsquare.io/api/ticker/?market=xmr_btc"
|
||||
fixerurl = 'http://api.fixer.io/latest?base=USD'
|
||||
finexbtc = 'https://api.bitfinex.com/v1/pubticker/XMRBTC'
|
||||
finexusd = 'https://api.bitfinex.com/v1/pubticker/XMRUSD'
|
||||
krakbtc = 'https://api.kraken.com/0/public/Ticker?pair=XMRXBT'
|
||||
krakbtceur = 'https://api.kraken.com/0/public/Ticker?pair=XBTEUR'
|
||||
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'
|
||||
|
||||
@sopel.module.commands('bfx', 'bitfinex')
|
||||
def bfx(bot, trigger):
|
||||
stringtosay = ''
|
||||
try:
|
||||
r = requests.get(finexbtc)
|
||||
j = r.json()
|
||||
stringtosay += "Last XMR/BTC trade at {0:.6f} on {1:.2f} 24 h XMR volume. ".format(float(j['last_price']), float(j['volume']))
|
||||
except:
|
||||
bot.say("Error getting XMR/BTC data")
|
||||
try:
|
||||
r = requests.get(finexusd)
|
||||
j = r.json()
|
||||
stringtosay += "Last XMR/USD trade at {0:.2f} on {1:.2f} 24 h XMR volume.".format(float(j['last_price']), float(j['volume']))
|
||||
except:
|
||||
bot.say("Error getting XMR/USD data")
|
||||
try:
|
||||
bot.say(stringtosay)
|
||||
except:
|
||||
bot.say("Error getting data")
|
||||
|
||||
@sopel.module.commands('krak', 'kraken')
|
||||
def krak(bot, trigger):
|
||||
stringtosay = ''
|
||||
try:
|
||||
r = requests.get(krakbtc)
|
||||
j = r.json()
|
||||
stringtosay += "Last XMR/BTC trade at {0:.6f} on {1:.2f} 24 h XMR volume. ".format(float(j['result']['XXMRXXBT']['c'][0]), float(j['result']['XXMRXXBT']['v'][1]))
|
||||
except:
|
||||
bot.say("Error getting XMR/BTC data")
|
||||
try:
|
||||
r = requests.get(krakusd)
|
||||
j = r.json()
|
||||
stringtosay += "Last XMR/USD trade at {0:.2f} on {1:.2f} 24 h XMR volume. ".format(float(j['result']['XXMRZUSD']['c'][0]), float(j['result']['XXMRZUSD']['v'][1]))
|
||||
except:
|
||||
bot.say("Error getting XMR/USD data")
|
||||
try:
|
||||
r = requests.get('https://api.kraken.com/0/public/Ticker?pair=XMREUR')
|
||||
j = r.json()
|
||||
stringtosay += "Last XMR/EUR trade at {0:.2f} on {1:.2f} 24 h XMR volume. ".format(float(j['result']['XXMRZEUR']['c'][0]), float(j['result']['XXMRZEUR']['v'][1]))
|
||||
except:
|
||||
bot.say("Error getting XMR/EUR data")
|
||||
try:
|
||||
bot.say(stringtosay)
|
||||
except:
|
||||
bot.say("Error getting data")
|
||||
|
||||
@sopel.module.commands('btckrak', 'btckraken', 'btceur')
|
||||
def krakeur(bot, trigger):
|
||||
stringtosay = ''
|
||||
try:
|
||||
r = requests.get(krakbtceur)
|
||||
j = r.json()
|
||||
stringtosay += "Last BTC/EUR trade at €{0:.2f} on {1:.2f} BTC 24 h volume. ".format(float(j['result']['XXBTZEUR']['c'][0]), float(j['result']['XXBTZEUR']['v'][0]))
|
||||
except:
|
||||
bot.say("Error getting BTC/EUR data")
|
||||
try:
|
||||
bot.say(stringtosay)
|
||||
except:
|
||||
bot.say("Error getting data")
|
||||
|
||||
@sopel.module.commands('chart')
|
||||
def chart(bot, trigger):
|
||||
bot.say('https://cryptowat.ch/poloniex/xmrbtc')
|
||||
|
||||
@sopel.module.commands('polo', 'poloniex', 'marco')
|
||||
@sopel.module.interval(3600)
|
||||
def polo(bot, trigger):
|
||||
if not trigger.group(2):
|
||||
try:
|
||||
r=requests.get(polourl)
|
||||
j=r.json()
|
||||
xmr=j["BTC_XMR"]
|
||||
last=float(xmr['last'])
|
||||
change=float(xmr['percentChange'])
|
||||
vol=float(xmr['baseVolume'])
|
||||
if change >= 0:
|
||||
sign = '+'
|
||||
else:
|
||||
sign = ''
|
||||
face = ''
|
||||
if change > 0.10:
|
||||
face = u'\u263d'.encode('utf8')
|
||||
if 0.10 >= change > 0.05:
|
||||
face = u'\u2661'.encode('utf8')
|
||||
if 0.05 >= change > 0.02:
|
||||
face = u'\u263a'.encode('utf8')
|
||||
if 0.02 >= change > -0.02:
|
||||
face = u'\u2694'.encode('utf8')
|
||||
if -0.02 >= change > -0.05:
|
||||
face = u'\u2639'.encode('utf8')
|
||||
if -0.05 >= change > -0.1:
|
||||
face = u'\u2620'.encode('utf8')
|
||||
if change < -0.1:
|
||||
face = u'\u262d'.encode('utf8')
|
||||
bot.say("Poloniex at {0:.8f} BTC; {1}{2:.2f}% over 24 hours on {3:.3f} BTC volume {4}".format(last, sign, change*100, vol, face))
|
||||
except:
|
||||
bot.say("Error retrieving data from Poloniex")
|
||||
else:
|
||||
coin = trigger.group(2).upper()
|
||||
try:
|
||||
r=requests.get(polourl)
|
||||
j=r.json()
|
||||
except:
|
||||
bot.say("Error connecting to Poloniex")
|
||||
if len(coin) > 5 or len(coin) < 2:
|
||||
bot.say("Coin ticker is too long or short")
|
||||
# elif coin == "PASC":
|
||||
# bot.say("COBOL only in #monero-markets")
|
||||
# elif coin == "NAUT":
|
||||
# bot.say("That ship has sailed...")
|
||||
else:
|
||||
label="BTC_" + coin
|
||||
try:
|
||||
ticker=j[label]
|
||||
last=float(ticker['last'])
|
||||
change=float(ticker['percentChange'])
|
||||
vol=float(ticker['baseVolume'])
|
||||
if change >= 0:
|
||||
sign = '+'
|
||||
else:
|
||||
sign = ''
|
||||
bot.say("{0} at {1:.8f} BTC; {2}{3:.2f}% over 24 hours on {4:.3f} BTC volume".format(coin, last, sign, change*100, vol))
|
||||
except:
|
||||
bot.say("ERROR!")
|
||||
|
||||
@sopel.module.commands('lending')
|
||||
def lending(bot, trigger):
|
||||
try:
|
||||
r=requests.get(poloxmrlendurl)
|
||||
j=r.json()
|
||||
amnt=0
|
||||
currenttime=time.time()
|
||||
for i in j['offers']:
|
||||
amnt+=float(i['amount'])
|
||||
bot.say("Total amount of XMR available {0:,.2f}. Changed by {1:.2f} in the last {2:.2f} hours".format(amnt, amnt-prevamnt, (currenttime-prevtime)/3600))
|
||||
global prevamnt
|
||||
prevamnt=amnt
|
||||
global prevtime
|
||||
prevtime=currenttime
|
||||
except:
|
||||
bot.say("Something bad happened :o")
|
||||
|
||||
|
||||
@sopel.module.commands('trex', 'bittrex')
|
||||
def trex(bot, trigger):
|
||||
if not trigger.group(2):
|
||||
geturl = trexurl+'xmr'
|
||||
else:
|
||||
geturl = trexurl + trigger.group(2)
|
||||
try:
|
||||
r = requests.get(geturl)
|
||||
j = r.json()
|
||||
xmr=j['result'][0]
|
||||
last=float(xmr['Last'])
|
||||
change=((last/float(xmr['PrevDay']))-1)
|
||||
vol=float(xmr['BaseVolume'])
|
||||
bot.say("Bittrex at {0:.8f} BTC; {1:.2f}% over 24 hours on {2:.3f} BTC volume".format(last, change*100, vol))
|
||||
except:
|
||||
bot.say("Error retrieving data from Bittrex")
|
||||
|
||||
@sopel.module.commands('bsq', 'bitsquare')
|
||||
def bsq(bot, trigger):
|
||||
try:
|
||||
r = requests.get(bitsquareurl)
|
||||
j = r.json()
|
||||
xmr=j['xmr_btc']
|
||||
last=float(xmr['last'])
|
||||
vol=float(xmr['volume_right'])
|
||||
bot.say("Bitsquare at {0:.8f} BTC on {1:.3f} BTC volume".format(last, vol))
|
||||
except:
|
||||
bot.say("Error retrieving data from Bitsquare")
|
||||
|
||||
@sopel.module.commands('cryptopia')
|
||||
def cryptopia(bot, trigger):
|
||||
try:
|
||||
r = requests.get(cryptopiaurl)
|
||||
j = r.json()
|
||||
xmr=j['Data']
|
||||
last=float(xmr['LastPrice'])
|
||||
change=float(xmr['Change'])
|
||||
vol=float(xmr['Volume'])
|
||||
bot.say("Cryptopia at {0:.8f} BTC; {1:.2f}% over 24 hours on {2:.3f} BTC volume".format(last, change, vol*last))
|
||||
except:
|
||||
bot.say("Error retrieving data from Cryptopia")
|
||||
|
||||
@sopel.module.commands('cmc', 'coinmarketcap')
|
||||
def cmc(bot, trigger):
|
||||
try:
|
||||
r = requests.get('https://api.coinmarketcap.com/v1/ticker?limit=100')
|
||||
j = r.json()
|
||||
except:
|
||||
bot.say("Can't connect to API")
|
||||
if not trigger.group(2):
|
||||
symbol = 'XMR'
|
||||
else:
|
||||
symbol = trigger.group(2)
|
||||
symbol = symbol.upper()
|
||||
try:
|
||||
for i in j:
|
||||
if i['symbol'] == symbol:
|
||||
name = i['name']
|
||||
rank = i['rank']
|
||||
price_usd = float(i['price_usd'])
|
||||
price_btc = float(i['price_btc'])
|
||||
volume_usd = float(i['24h_volume_usd'])
|
||||
market_cap_usd = float(i['market_cap_usd'])
|
||||
available_supply = float(i['available_supply'])
|
||||
total_supply = float(i['total_supply'])
|
||||
percent_change_24h = float(i['percent_change_24h'])
|
||||
bot.say("{0} ({1}) is #{2}. Last price ${3:.2f} / ฿{4:.8f}. 24h volume ${5:,.0f} changed {6}%. Market cap ${7:,.0f}. Available / total coin supply {8:,.0f} / {9:,.0f}.".format(name, symbol, rank, price_usd, price_btc, volume_usd, percent_change_24h, market_cap_usd, available_supply, total_supply))
|
||||
except:
|
||||
bot.say("Error parsing ticker")
|
||||
|
||||
@sopel.module.commands('okc', 'okcoin')
|
||||
def okc(bot, trigger):
|
||||
try:
|
||||
r = requests.get(okcquar)
|
||||
j = r.json()
|
||||
xmr=j['ticker']
|
||||
last=float(xmr['last'])
|
||||
vol=float(xmr['vol'])
|
||||
bot.say("OKcoin quarterly futures at ${0:.2f} on {1:.0f} volume".format(last, vol))
|
||||
except:
|
||||
bot.say("Error retrieving data from OKCoin")
|
||||
|
||||
@sopel.module.commands('pepe', 'pepecash')
|
||||
def pepe(bot, trigger):
|
||||
try:
|
||||
r = requests.get('https://tuxexchange.com/api?method=getticker')
|
||||
j = r.json()
|
||||
pepe=j['BTC_PEPECASH']
|
||||
last=float(pepe['last'])
|
||||
vol=float(pepe['baseVolume'])
|
||||
change=float(pepe['percentChange'])
|
||||
bot.say("Pepecash at {0:.8f} BTC on {1:.3f} BTC volume, changed {2:.2f}% over last 24 hr".format(last, vol, change))
|
||||
except:
|
||||
bot.say("Error retrieving data from Tuxexchange")
|
||||
|
||||
@sopel.module.commands('pepexmr')
|
||||
def pepexmr(bot, trigger):
|
||||
try:
|
||||
r = requests.get('https://tuxexchange.com/api?method=getticker')
|
||||
j = r.json()
|
||||
pepe=j['BTC_PEPECASH']
|
||||
pepelast=float(pepe['last'])
|
||||
r=requests.get(polourl)
|
||||
j=r.json()
|
||||
xmr=j["BTC_XMR"]
|
||||
xmrlast=float(xmr['last'])
|
||||
bot.say("Pepe/XMR ratio is : {0:.8f}".format(pepelast/xmrlast))
|
||||
except:
|
||||
bot.say("FAILURE!")
|
||||
|
||||
|
||||
@sopel.module.commands('tall')
|
||||
def tall(bot, trigger):
|
||||
stringtosend = ''
|
||||
fixerurl = 'http://api.fixer.io/latest?base=USD'
|
||||
stampurl = 'https://www.bitstamp.net/api/ticker/'
|
||||
btceurl = 'https://btc-e.com/api/3/ticker/btc_usd'
|
||||
finexurl = 'https://api.bitfinex.com/v1/pubticker/BTCUSD'
|
||||
# btccurl = 'https://pro-data.btcc.com/data/pro/ticker?symbol=XBTCNY'
|
||||
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'
|
||||
# Get conversion rate
|
||||
try:
|
||||
fixerresult = requests.get(fixerurl)
|
||||
fixerjson = fixerresult.json()
|
||||
usdcny = fixerjson['rates']['CNY']
|
||||
usdeur = fixerjson['rates']['EUR']
|
||||
except:
|
||||
usdcny = 7
|
||||
# Bitstamp
|
||||
try:
|
||||
stampresult = requests.get(stampurl)
|
||||
stampjson = stampresult.json()
|
||||
except:
|
||||
stampjson = False
|
||||
if stampjson:
|
||||
stringtosend += "Bitstamp last: {0:,.2f}, vol: {1:,.1f} | ".format(float(stampjson['last']), float(stampjson['volume']))
|
||||
# BTC-E
|
||||
try:
|
||||
btceresult = requests.get(btceurl)
|
||||
btcejson = btceresult.json()
|
||||
except:
|
||||
btcejson = False
|
||||
if btcejson:
|
||||
stringtosend += "BTC-E last: {0:,.2f}, vol: {1:,.1f} | ".format(float(btcejson['btc_usd']['last']), float(btcejson['btc_usd']['vol_cur']))
|
||||
# Gemini
|
||||
try:
|
||||
gemiresult = requests.get(gemiurl)
|
||||
gemijson = gemiresult.json()
|
||||
except:
|
||||
gemijson = False
|
||||
if gemijson:
|
||||
try:
|
||||
stringtosend += "Gemini last: {0:,.2f}, vol: {1:,.1f} | ".format(float(gemijson['last']), float(gemijson['volume']['BTC']))
|
||||
except:
|
||||
pass
|
||||
# Gdax
|
||||
try:
|
||||
gdaxresult = requests.get(gdaxurl)
|
||||
gdaxjson = gdaxresult.json()
|
||||
except:
|
||||
gdaxjson = False
|
||||
if gdaxjson:
|
||||
stringtosend += "GDAX price: {0:,.2f} | ".format(float(gdaxjson['data']['rates']['USD']))
|
||||
# Bitfinex
|
||||
try:
|
||||
finexresult = requests.get(finexurl)
|
||||
finexjson = finexresult.json()
|
||||
except:
|
||||
finexjson = False
|
||||
if finexjson:
|
||||
stringtosend += "Bitfinex last: {0:,.2f}, vol: {1:,.1f} | ".format(float(finexjson['last_price']), float(finexjson['volume']))
|
||||
# BTCC
|
||||
try:
|
||||
btccresult = requests.get(btccurl)
|
||||
btccjson = btccresult.json()
|
||||
except:
|
||||
btccjson = False
|
||||
if btccjson:
|
||||
stringtosend += "BTCC last: {0:,.2f}, vol: {1:,.1f} | ".format(float(btccjson['ticker']['last'])/usdcny, float(btccjson['ticker']['vol']))
|
||||
# Huobi
|
||||
try:
|
||||
huobiresult = requests.get(huobiurl)
|
||||
huobijson = huobiresult.json()
|
||||
except:
|
||||
huobijson = False
|
||||
if huobijson:
|
||||
stringtosend += "Huobi last: {0:,.2f}, vol: {1:,.1f} | ".format(float(huobijson['ticker']['last'])/usdcny, float(huobijson['ticker']['vol']))
|
||||
# Send the tickers to IRC
|
||||
bot.say(stringtosend)
|
||||
|
||||
|
||||
@sopel.module.commands('usd')
|
||||
def usd(bot, trigger):
|
||||
try:
|
||||
r=requests.get('https://api.coinmarketcap.com/v1/ticker/monero/')
|
||||
j=r.json()
|
||||
price=float(j[0]['price_usd'])
|
||||
bot.say("Monero price in USD = ${0:,.2f}".format(price))
|
||||
except:
|
||||
bot.say("Failed to retrieve price.")
|
||||
|
||||
@sopel.module.commands('aud')
|
||||
def aud(bot, trigger):
|
||||
# Get conversion rate
|
||||
try:
|
||||
fixerresult = requests.get(fixerurl)
|
||||
fixerjson = fixerresult.json()
|
||||
usdaud = fixerjson['rates']['AUD']
|
||||
except:
|
||||
usdaud = 1.35
|
||||
try:
|
||||
r=requests.get('https://api.coinmarketcap.com/v1/ticker/monero/')
|
||||
j=r.json()
|
||||
price=float(j[0]['price_usd'])*usdaud
|
||||
bot.say("Monero price in AUD = ${0:,.2f}".format(price))
|
||||
except:
|
||||
bot.say("Failed to retrieve price.")
|
||||
|
||||
@sopel.module.commands('cny')
|
||||
def cny(bot, trigger):
|
||||
# Get conversion rate
|
||||
try:
|
||||
fixerresult = requests.get(fixerurl)
|
||||
fixerjson = fixerresult.json()
|
||||
usdcny = fixerjson['rates']['CNY']
|
||||
except:
|
||||
usdjpy = 6.8
|
||||
try:
|
||||
r=requests.get('https://api.coinmarketcap.com/v1/ticker/monero/')
|
||||
j=r.json()
|
||||
price=float(j[0]['price_usd'])*usdcny
|
||||
bot.say("Monero price in CNY = ¥{0:,.2f}".format(price))
|
||||
except:
|
||||
bot.say("Failed to retrieve price.")
|
||||
|
||||
@sopel.module.commands('jpy')
|
||||
def jpy(bot, trigger):
|
||||
# Get conversion rate
|
||||
try:
|
||||
fixerresult = requests.get(fixerurl)
|
||||
fixerjson = fixerresult.json()
|
||||
usdjpy = fixerjson['rates']['JPY']
|
||||
except:
|
||||
usdjpy = 110
|
||||
try:
|
||||
r=requests.get('https://api.coinmarketcap.com/v1/ticker/monero/')
|
||||
j=r.json()
|
||||
price=float(j[0]['price_usd'])*usdjpy
|
||||
bot.say("Monero price in JPY = ¥{0:,.2f}".format(price))
|
||||
except:
|
||||
bot.say("Failed to retrieve price.")
|
||||
|
||||
@sopel.module.commands('eur')
|
||||
def eur(bot, trigger):
|
||||
# Get conversion rate
|
||||
try:
|
||||
fixerresult = requests.get(fixerurl)
|
||||
fixerjson = fixerresult.json()
|
||||
usdeur = fixerjson['rates']['EUR']
|
||||
except:
|
||||
usdeur = 0.95
|
||||
try:
|
||||
r=requests.get('https://api.coinmarketcap.com/v1/ticker/monero/')
|
||||
j=r.json()
|
||||
price=float(j[0]['price_usd'])*usdeur
|
||||
bot.say("Monero price in EUR = €{0:,.2f}".format(price))
|
||||
except:
|
||||
bot.say("Failed to retrieve price.")
|
||||
|
||||
@sopel.module.commands('cad')
|
||||
def cad(bot, trigger):
|
||||
# Get conversion rate
|
||||
try:
|
||||
fixerresult = requests.get(fixerurl)
|
||||
fixerjson = fixerresult.json()
|
||||
usdcad = fixerjson['rates']['CAD']
|
||||
except:
|
||||
usdcad = 1.35
|
||||
try:
|
||||
r=requests.get('https://api.coinmarketcap.com/v1/ticker/monero/')
|
||||
j=r.json()
|
||||
price=float(j[0]['price_usd'])*usdcad
|
||||
bot.say("Monero price in CAD = ${0:,.2f}".format(price))
|
||||
except:
|
||||
bot.say("Failed to retrieve price.")
|
||||
|
||||
@sopel.module.commands('gbp')
|
||||
def gbp(bot, trigger):
|
||||
# Get conversion rate
|
||||
try:
|
||||
fixerresult = requests.get(fixerurl)
|
||||
fixerjson = fixerresult.json()
|
||||
usdgbp = fixerjson['rates']['GBP']
|
||||
except:
|
||||
usdgbp = 0.81
|
||||
try:
|
||||
r=requests.get('https://api.coinmarketcap.com/v1/ticker/monero/')
|
||||
j=r.json()
|
||||
price=float(j[0]['price_usd'])*usdgbp
|
||||
bot.say("Monero price in GBP = £{0:,.2f}".format(price))
|
||||
except:
|
||||
bot.say("Failed to retrieve price.")
|
||||
|
||||
@sopel.module.commands('thb')
|
||||
def thb(bot, trigger):
|
||||
# Get conversion rate
|
||||
try:
|
||||
fixerresult = requests.get(fixerurl)
|
||||
fixerjson = fixerresult.json()
|
||||
usdthb = fixerjson['rates']['THB']
|
||||
except:
|
||||
usdthb = 1.35
|
||||
try:
|
||||
r=requests.get('https://api.coinmarketcap.com/v1/ticker/monero/')
|
||||
j=r.json()
|
||||
price=float(j[0]['price_usd'])*usdthb
|
||||
bot.say("Monero price in THB = ฿{0:,.2f}".format(price))
|
||||
except:
|
||||
bot.say("Failed to retrieve price.")
|
||||
|
||||
@sopel.module.commands('zar')
|
||||
def zar(bot, trigger):
|
||||
# Get conversion rate
|
||||
try:
|
||||
fixerresult = requests.get(fixerurl)
|
||||
fixerjson = fixerresult.json()
|
||||
usdzar = fixerjson['rates']['ZAR']
|
||||
except:
|
||||
usdzar = 13.05
|
||||
try:
|
||||
r=requests.get('https://api.coinmarketcap.com/v1/ticker/monero/')
|
||||
j=r.json()
|
||||
price=float(j[0]['price_usd'])*usdzar
|
||||
bot.say("Monero price in ZAR = R{0:,.2f}".format(price))
|
||||
except:
|
||||
bot.say("Failed to retrieve price.")
|
||||
|
||||
@sopel.module.commands('nzd')
|
||||
def nzd(bot, trigger):
|
||||
# Get conversion rate
|
||||
try:
|
||||
fixerresult = requests.get(fixerurl)
|
||||
fixerjson = fixerresult.json()
|
||||
usdnzd = fixerjson['rates']['NZD']
|
||||
except:
|
||||
usdnzd = 1.405
|
||||
try:
|
||||
r=requests.get('https://api.coinmarketcap.com/v1/ticker/monero/')
|
||||
j=r.json()
|
||||
price=float(j[0]['price_usd'])*usdnzd
|
||||
bot.say("Monero price in NZD = ${0:,.2f}".format(price))
|
||||
except:
|
||||
bot.say("Failed to retrieve price.")
|
||||
|
||||
@sopel.module.commands('ntd')
|
||||
def ntd(bot, trigger):
|
||||
# Get conversion rate
|
||||
try:
|
||||
ntdurl = r'https://query.yahooapis.com/v1/public/yql?q=select%20*%20from%20yahoo.finance.xchange%20where%20pair%20in%20("USDTWD")&format=json&diagnostics=true&env=store%3A%2F%2Fdatatables.org%2Falltableswithkeys&callback='
|
||||
fixerresult = requests.get(ntdurl)
|
||||
fixerjson = fixerresult.json()
|
||||
usdntd = float(fixerjson['query']['results']['rate']['Rate'])
|
||||
except:
|
||||
bot.say("Failed to get NTD value")
|
||||
usdntd = 32
|
||||
try:
|
||||
r=requests.get('https://api.coinmarketcap.com/v1/ticker/monero/')
|
||||
j=r.json()
|
||||
price=float(j[0]['price_usd'])*usdntd
|
||||
bot.say("Monero price in NTD = ${0:,.2f}".format(price))
|
||||
except:
|
||||
bot.say("Failed to retrieve price.")
|
||||
|
||||
@sopel.module.commands('ugx')
|
||||
def ugx(bot, trigger):
|
||||
# Get conversion rate
|
||||
try:
|
||||
ugxurl = r'https://query.yahooapis.com/v1/public/yql?q=select%20*%20from%20yahoo.finance.xchange%20where%20pair%20in%20("USDUGX")&format=json&diagnostics=true&env=store%3A%2F%2Fdatatables.org%2Falltableswithkeys&callback='
|
||||
fixerresult = requests.get(ntdurl)
|
||||
fixerjson = fixerresult.json()
|
||||
usdugx = florat(fixerjson['query']['results']['rate']['Rate'])
|
||||
except:
|
||||
usdugx = 3200
|
||||
try:
|
||||
r=requests.get('https://api.coinmarketcap.com/v1/ticker/monero/')
|
||||
j=r.json()
|
||||
price=float(j[0]['price_usd'])*usdugx
|
||||
bot.say("Monero price in UGX = {0:,.2f} shillings".format(price))
|
||||
except:
|
||||
bot.say("Failed to retrieve price.")
|
||||
|
||||
@sopel.module.commands('log')
|
||||
def log(bot, trigger):
|
||||
volurl='https://c-cex.com/t/volume_btc.json'
|
||||
try:
|
||||
r=requests.get(volurl)
|
||||
j=r.json()
|
||||
last=float(j['ticker']['log']['last'])
|
||||
vol=float(j['ticker']['log']['vol'])
|
||||
bot.say("Last price on c-cex for LOG at {0:.8f} BTC on {1:.3f} BTC volume.".format(last, vol))
|
||||
except:
|
||||
bot.say("C-cex sucks")
|
|
@ -0,0 +1,277 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
import sopel.module
|
||||
import random
|
||||
import re
|
||||
import requests
|
||||
import praw
|
||||
|
||||
@sopel.module.commands('aminorex')
|
||||
def aminorex(bot, trigger):
|
||||
bot.say('if i could replace my wife with a robot... i might seriously think about it')
|
||||
|
||||
@sopel.module.commands('banana')
|
||||
def banana(bot, trigger):
|
||||
bot.say('(')
|
||||
|
||||
@sopel.module.commands('bananas')
|
||||
def bananas(bot, trigger):
|
||||
bot.say('(((')
|
||||
|
||||
@sopel.module.commands('barolo')
|
||||
def barolo(bot, trigger):
|
||||
bot.say('I just opened a 2004 barolo in your and all the devs honor -- https://i.ytimg.com/vi/-JvdfsIeb-s/hqdefault.jpg')
|
||||
|
||||
@sopel.module.commands('bear')
|
||||
def banana(bot, trigger):
|
||||
bot.say(u'ʕ ·(エ)· ʔ'.encode('utf8'))
|
||||
|
||||
@sopel.module.commands('buyorsell')
|
||||
def buyorsell(bot, trigger):
|
||||
draw = random.random()
|
||||
if draw < 0.33:
|
||||
silly_string = "Sell, sell, sell!"
|
||||
elif 0.66 > draw >= 0.33:
|
||||
silly_string = "Hodl!"
|
||||
elif 1 > draw >= 0.66:
|
||||
silly_string = "Buy, buy, buy!"
|
||||
bot.say(silly_string)
|
||||
|
||||
@sopel.module.commands('china')
|
||||
def china(bot, trigger):
|
||||
bot.say('https://www.youtube.com/watch?v=RbM2F-cfN0A')
|
||||
|
||||
@sopel.module.commands('cursive')
|
||||
def cursive(bot, trigger):
|
||||
instring = trigger.group(2)
|
||||
outstring = u''
|
||||
normals = ['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z','A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z']
|
||||
curses = [u'𝓪',u'𝓫',u'𝓬',u'𝓭',u'𝓮',u'𝓯',u'𝓰',u'𝓱',u'𝓲',u'𝓳',u'𝓴',u'𝓵',u'𝓶',u'𝓷',u'𝓸',u'𝓹',u'𝓺',u'𝓻',u'𝓼',u'𝓽',u'𝓾',u'𝓿',u'𝔀',u'𝔁',u'𝔂',u'𝔃',u'𝓐',u'𝓑',u'𝓒',u'𝓓',u'𝓔',u'𝓕',u'𝓖',u'𝓗',u'𝓘',u'𝓙',u'𝓚',u'𝓛',u'𝓜',u'𝓝',u'𝓞',u'𝓟',u'𝓠',u'𝓡',u'𝓢',u'𝓣',u'𝓤',u'𝓥',u'𝓦',u'𝓧',u'𝓨',u'𝓩']
|
||||
for idx, val in enumerate(instring):
|
||||
if val in normals:
|
||||
outstring += curses[normals.index(val)]
|
||||
else:
|
||||
outstring += val
|
||||
bot.say(outstring)
|
||||
|
||||
@sopel.module.commands('dash')
|
||||
def dash(bot, trigger):
|
||||
bot.say('http://www.dash-wash.com/it-it')
|
||||
|
||||
@sopel.module.commands('dealwithit')
|
||||
def dealwithit(bot, trigger):
|
||||
bot.say(u'(•_•) ( •_•)>⌐■-■ (⌐■_■)'.encode('utf8'))
|
||||
|
||||
@sopel.module.commands('disapprove')
|
||||
def disapprove(bot, trigger):
|
||||
bot.say(u'ಠ_ಠ'.encode('utf8'))
|
||||
|
||||
@sopel.module.commands('ded')
|
||||
def ded(bot, trigger):
|
||||
if random.random() < 0.5:
|
||||
bot.say('http://i3.kym-cdn.com/photos/images/original/000/715/140/3b2.jpg')
|
||||
else:
|
||||
bot.say('https://imgur.com/a/yzNZW')
|
||||
|
||||
@sopel.module.commands('donate', 'donation')
|
||||
def dash(bot, trigger):
|
||||
bot.say('45SkxgDmcLmW5ByS7w9AG78JuJRvCoVKCdGJWnd4US95CBUAtvdGAdM2oHgZgTGjkEAUcwdqcryM819aqdeiKxHSQC8HkmS', trigger.nick)
|
||||
|
||||
@sopel.module.commands('eth')
|
||||
def eth(bot, trigger):
|
||||
bot.say(u'The world computer 💻🌐'.encode('utf8'))
|
||||
|
||||
@sopel.module.commands('flip')
|
||||
def flip(bot, trigger):
|
||||
bot.say(u'(╯°□°)╯︵ ┻━┻'.encode('utf8'))
|
||||
|
||||
fuckyouoptions = [
|
||||
"http://imgur.com/Kt8os8v",
|
||||
"https://pbs.twimg.com/profile_images/502111486915788801/DtB5ruDz_400x400.jpeg",
|
||||
"http://s2.quickmeme.com/img/70/7073ff0ce9c54f6672f157ebef668c1b6bb123d15fc2e2bc062ec1558f964820.jpg",
|
||||
"http://static.deathandtaxesmag.com/uploads/2015/01/staff-troll-fuck-you.png",
|
||||
]
|
||||
@sopel.module.commands('fuckyou')
|
||||
def fuckyou(bot, trigger):
|
||||
bot.say(random.choice(fuckyouoptions))
|
||||
|
||||
@sopel.module.commands('gui')
|
||||
def gui(bot, trigger):
|
||||
bot.say('http://imgur.com/a/hnxfS')
|
||||
|
||||
@sopel.module.commands('isittrue')
|
||||
def isittrue(bot, trigger):
|
||||
draw = random.random()
|
||||
if draw < 0.33:
|
||||
silly_string = "True as the day is long."
|
||||
elif 0.66 > draw >= 0.33:
|
||||
silly_string = "Irrelevant question in this post-truth world."
|
||||
elif 1 > draw >= 0.66:
|
||||
silly_string = "Lies! Damn Lies! It's statitistics!"
|
||||
bot.say(silly_string)
|
||||
|
||||
@sopel.module.commands('jaxx')
|
||||
def jaxx(bot, trigger):
|
||||
bot.say(u'This command will be implemented soon. Honest. Especially if the devs can provide some unpaid assistance. Soon™...')
|
||||
|
||||
@sopel.module.commands('joshua1234')
|
||||
def jaxx(bot, trigger):
|
||||
bot.say(u'The first, second, third, and fourth amongst joshes.')
|
||||
|
||||
@sopel.module.commands('lenny')
|
||||
def lenny(bot, trigger):
|
||||
bot.say(u'( ͡° ͜ʖ ͡°)'.encode('utf8'))
|
||||
|
||||
@sopel.module.commands('masternode', 'masternodes')
|
||||
def masternode(bot, trigger):
|
||||
bot.say('http://hadoopilluminated.com/hadoop_illuminated/images/hdfs3.jpg')
|
||||
|
||||
@sopel.module.commands('moon')
|
||||
def moon(bot, trigger):
|
||||
bot.say(u'┗(°0°)┛'.encode('utf8'))
|
||||
|
||||
@sopel.module.commands('multisig')
|
||||
def multisig(bot, trigger):
|
||||
bot.say(u'𝓼𝓲𝓰𝓷𝓪𝓽𝓾𝓻𝓮 𝓼𝓲𝓰𝓷𝓪𝓽𝓾𝓻𝓮'.encode('utf8'))
|
||||
|
||||
@sopel.module.commands('nomnomnom')
|
||||
def nomnomnom(bot, trigger):
|
||||
bot.say(u'ᗧ•••ᗣ'.encode('utf8'))
|
||||
|
||||
@sopel.module.commands('noom')
|
||||
def noom(bot, trigger):
|
||||
bot.say(u'┏(.0.)┓'.encode('utf8'))
|
||||
|
||||
@sopel.module.commands('pero')
|
||||
def pero(bot, trigger):
|
||||
bot.say('https://www.youtube.com/watch?v=QqreRufrkxM')
|
||||
|
||||
@sopel.module.commands('pleaseconfirm', 'confirm')
|
||||
def confirm(bot, trigger):
|
||||
draw = random.random()
|
||||
if draw < 0.20:
|
||||
silly_string = "I can confirm that it is true"
|
||||
elif 0.4 > draw >= 0.20:
|
||||
silly_string = "This is true"
|
||||
elif 0.6 > draw >= 0.4:
|
||||
silly_string = "Fake news"
|
||||
elif 0.8 > draw >= 0.6:
|
||||
silly_string = "Alternative fact"
|
||||
elif 1 > draw >= 0.8:
|
||||
silly_string = "The outlook is murky, ask again later"
|
||||
bot.say(silly_string)
|
||||
|
||||
@sopel.module.commands('rarepepe', 'rare')
|
||||
def rarepepe(bot, trigger):
|
||||
try:
|
||||
r=requests.get('https://rarepepewallet.com/feed')
|
||||
j=r.json()
|
||||
except:
|
||||
bot.say("Problem getting rarepepe data :sadfrogface:")
|
||||
try:
|
||||
if trigger.group(2) == None:
|
||||
name=random.choice(j.keys())
|
||||
else:
|
||||
name=trigger.group(2).upper()
|
||||
pepe=j[name]
|
||||
bot.say("{0} is the #{1} card in series {2} of which {3} exist {4}".format(name, pepe['order'], pepe['series'], pepe['quantity'], pepe['img_url'].replace('\\', '')))
|
||||
except:
|
||||
bot.say("{0} rare pepe doesn't seem to exist".format(trigger.group(2)))
|
||||
|
||||
|
||||
@sopel.module.commands('rip')
|
||||
def rip(bot, trigger):
|
||||
bot.say(u'(X_X) ☜ (◉▂◉ ) we hardly knew ye'.encode('utf8'))
|
||||
|
||||
@sopel.module.commands('romerito', 'romero')
|
||||
def romerito(bot, trigger):
|
||||
draw = random.random()
|
||||
if draw < 0.25:
|
||||
silly_string = "O Romerito, Romerito! wherefore art thou Romerito?"
|
||||
elif 0.5 > draw >= 0.25:
|
||||
silly_string = "To buy or not to buy: that is the question"
|
||||
elif 0.75 > draw >= 0.5:
|
||||
silly_string = "Cowards die many times before their deaths; the Romerito never taste of death"
|
||||
elif 1 > draw >= 0.75:
|
||||
silly_string = "Et tu, Romerito!"
|
||||
bot.say(silly_string)
|
||||
|
||||
@sopel.module.commands('scam')
|
||||
def scam(bot, trigger):
|
||||
bot.say(u'http://i.imgflip.com/is8.jpg')
|
||||
|
||||
@sopel.module.commands('soon')
|
||||
def soon(bot, trigger):
|
||||
bot.say(u'Two weeks™'.encode('utf8'))
|
||||
|
||||
@sopel.module.commands('shrug')
|
||||
def shrug(bot, trigger):
|
||||
bot.say(u'¯\_(ツ)_/¯'.encode('utf8'))
|
||||
|
||||
@sopel.module.commands('summon')
|
||||
def summon(bot, trigger):
|
||||
if trigger.group(2) == None:
|
||||
bot.say("{0} has summoned...no one".format(trigger.nick))
|
||||
else:
|
||||
try:
|
||||
trigger.group(2).decode('ascii')
|
||||
bot.say("{0} has summoned {1}, ༼つ ◕_◕ ༽つ come to us {1} ༼つ ◕_◕ ༽つ".format(trigger.nick, trigger.group(2)))
|
||||
except:
|
||||
bot.say("Stop using non-ascii characters! (╯°□°)╯︵ ( . 0 .)")
|
||||
|
||||
@sopel.module.commands('timetravelpp')
|
||||
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")
|
||||
|
||||
reddit=praw.Reddit(user_agent='monerobux')
|
||||
@sopel.module.commands('tinytrump')
|
||||
def tinytrump(bot, trigger):
|
||||
try:
|
||||
sub=reddit.get_subreddit('tinytrump')
|
||||
posts=sub.get_new(limit=100)
|
||||
n=random.randint(0,100)
|
||||
for i, post in enumerate(posts):
|
||||
if i==n:
|
||||
bot.say(post.url)
|
||||
except:
|
||||
bot.say("Something something reddit's servers")
|
||||
|
||||
@sopel.module.commands('trump')
|
||||
def trump(bot, trigger):
|
||||
bot.say("Monero is the best crypto, believe me, I know crypto and it's going to be yuuuuuuuge!")
|
||||
|
||||
@sopel.module.commands('unflip')
|
||||
def unflip(bot, trigger):
|
||||
bot.say(u'┬─┬ノ( º _ ºノ)'.encode('utf8'))
|
||||
|
||||
urmomoptions = [
|
||||
"ur mom is so stupid she bought all the dash",
|
||||
"ur momma got a peg leg with a kickstand",
|
||||
"ur mom is so fat it looks like she's just gliding across the floor",
|
||||
"your mother is so obese she would have mass whether or not the Higgs boson exists",
|
||||
"ur mom is so fat that her blood type is nutella",
|
||||
"ur mama is so fat she wears neck deoderant",
|
||||
"ur mom's middle name is Mudbone",
|
||||
"ur momma has a glass eye with a fish in it",
|
||||
"ur mama is so stupid she sold her romero for bitcoins",
|
||||
"ur momma look like a Simpsons character",
|
||||
"ur mom is Amanda B Johnson"
|
||||
]
|
||||
@sopel.module.commands('urmom', 'yourmom', 'yomom', 'yomomma')
|
||||
def urmom(bot, trigger):
|
||||
bot.say(random.choice(urmomoptions))
|
||||
|
||||
@sopel.module.commands('wat')
|
||||
def wat(bot, trigger):
|
||||
bot.say("https://www.destroyallsoftware.com/talks/wat")
|
||||
|
||||
@sopel.module.commands('zec', 'zcash')
|
||||
def zcash(bot, trigger):
|
||||
bot.say('Trust us guys, we totally smashed that computer up, with like...magnetic baseball bats.')
|
||||
|
||||
@sopel.module.rule('monerobux o\/')
|
||||
def wave(bot, trigger):
|
||||
#bot.reply(u'‹^› ‹(•_•)› ‹^›'.encode('utf8'))
|
||||
bot.reply('hello')
|
||||
#@sopel.module.rule('[Tt]rump')
|
||||
#def politics(bot, trigger):
|
||||
# bot.reply("politics is the mind killer")
|
Loading…
Reference in New Issue