Update because reasons

This commit is contained in:
root 2017-04-26 04:29:09 +00:00
parent 9746b52881
commit 558db2de8a
8 changed files with 227 additions and 38 deletions

View File

@ -4,6 +4,20 @@ import re
networkurl = "http://api.minexmr.com:8080/stats" networkurl = "http://api.minexmr.com:8080/stats"
@sopel.module.commands('fork', 'forkening')
def fork(bot, trigger):
try:
r=requests.get(networkurl)
j=r.json()
except Exception,e:
pass
try:
height=j["network"]["height"]
forkheight=1288616
bot.say("The current block height is {0:,}. Fork height is {1:,}. {2:,} blocks to go, happening in approximately {3:.2f} hours.".format(height,forkheight,forkheight-height,(forkheight-height)/30.0))
except:
bot.say("Something borked -_-")
@sopel.module.commands('network') @sopel.module.commands('network')
def network(bot, trigger): def network(bot, trigger):
try: try:
@ -41,7 +55,7 @@ def mempool(bot, trigger):
def blocksize(bot, trigger): def blocksize(bot, trigger):
try: try:
r=requests.get('http://moneroblocks.info/stats/block-medians') r=requests.get('http://moneroblocks.info/stats/block-medians')
size=re.search('&nbsp;<\/strong><\/div>\s*<div class=\"col-xs-5 col-sm-3 col-md-1\">(\d*)', r.text) size=re.search('&nbsp;<\/strong><\/div>\s*<div class=\"col-xs-2\">(\d*)', r.text)
bot.say("Median blocksize over last 200 blocks is {0} bytes".format(size.group(1))) bot.say("Median blocksize over last 200 blocks is {0} bytes".format(size.group(1)))
except: except:
bot.say("Bomething sorked 0_0") bot.say("Bomething sorked 0_0")

BIN
network.pyc Normal file

Binary file not shown.

View File

@ -2,12 +2,13 @@
import sopel.module import sopel.module
import requests import requests
import time import time
import random
polourl = "https://poloniex.com/public?command=returnTicker" polourl = "https://poloniex.com/public?command=returnTicker"
poloxmrlendurl = "https://poloniex.com/public?command=returnLoanOrders&currency=XMR&limit=999999" poloxmrlendurl = "https://poloniex.com/public?command=returnLoanOrders&currency=XMR&limit=999999"
prevamnt, prevtime = 0, 0 prevamnt, prevtime = 0, 0
trexurl = "https://bittrex.com/api/v1.1/public/getmarketsummary?market=btc-" trexurl = "https://bittrex.com/api/v1.1/public/getmarketsummary?market=btc-"
cryptopiaurl = "https://www.cryptopia.co.nz/api/GetMarket/2999" cryptopiaurl = "https://www.cryptopia.co.nz/api/GetMarkets"
bitsquareurl = "https://market.bitsquare.io/api/ticker/?market=xmr_btc" bitsquareurl = "https://market.bitsquare.io/api/ticker/?market=xmr_btc"
fixerurl = 'http://api.fixer.io/latest?base=USD' fixerurl = 'http://api.fixer.io/latest?base=USD'
finexbtc = 'https://api.bitfinex.com/v1/pubticker/XMRBTC' finexbtc = 'https://api.bitfinex.com/v1/pubticker/XMRBTC'
@ -17,6 +18,7 @@ krakbtceur = 'https://api.kraken.com/0/public/Ticker?pair=XBTEUR'
krakusd = 'https://api.kraken.com/0/public/Ticker?pair=XMRUSD' krakusd = 'https://api.kraken.com/0/public/Ticker?pair=XMRUSD'
krakeur = 'https://api.kraken.com/0/public/Ticker?pair=XMREUR' 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' 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'
@sopel.module.commands('bfx', 'bitfinex') @sopel.module.commands('bfx', 'bitfinex')
def bfx(bot, trigger): def bfx(bot, trigger):
@ -64,6 +66,16 @@ def krak(bot, trigger):
except: except:
bot.say("Error getting data") bot.say("Error getting data")
@sopel.module.commands('usdt')
def usdt(bot, trigger):
try:
r = requests.get(krakusdt)
j = r.json()
stringtosay = "Last USDT/USD trade at ${0:.4f} on {1:.2f} USD 24 h volume. Highest bid at ${2:.4f}".format(float(j['result']['USDTZUSD']['c'][0]), float(j['result']['USDTZUSD']['v'][0]), float(j['result']['USDTZUSD']['b'][0]))
bot.say(stringtosay)
except:
bot.say("Error getting USDT/USD data")
@sopel.module.commands('btckrak', 'btckraken', 'btceur') @sopel.module.commands('btckrak', 'btckraken', 'btceur')
def krakeur(bot, trigger): def krakeur(bot, trigger):
stringtosay = '' stringtosay = ''
@ -128,6 +140,8 @@ def polo(bot, trigger):
# bot.say("COBOL only in #monero-markets") # bot.say("COBOL only in #monero-markets")
# elif coin == "NAUT": # elif coin == "NAUT":
# bot.say("That ship has sailed...") # bot.say("That ship has sailed...")
elif coin == "PIVX":
bot.say("Masternodes + PoS...what could possibly go wrong?")
else: else:
label="BTC_" + coin label="BTC_" + coin
try: try:
@ -193,40 +207,70 @@ def bsq(bot, trigger):
@sopel.module.commands('cryptopia') @sopel.module.commands('cryptopia')
def cryptopia(bot, trigger): def cryptopia(bot, trigger):
try: try:
if not trigger.group(2):
coin = 'XMR'
pair = 'BTC'
else:
coin = trigger.group(2).split(' ')[0].upper()
try:
if len(trigger.group(2).split(' ')[1]) > 1:
pair = trigger.group(2).split(' ')[1].upper()
else:
pair = "BTC"
except:
pair = "BTC"
r = requests.get(cryptopiaurl) r = requests.get(cryptopiaurl)
j = r.json() j = r.json()
xmr=j['Data'] found = False
last=float(xmr['LastPrice']) for i in j["Data"]:
change=float(xmr['Change']) if i["Label"] == coin+"/"+pair:
vol=float(xmr['Volume']) last=float(i['LastPrice'])
bot.say("Cryptopia at {0:.8f} BTC; {1:.2f}% over 24 hours on {2:.3f} BTC volume".format(last, change, vol*last)) change=float(i['Change'])
vol=float(i['Volume'])
bot.say("{0} on Cryptopia at {1:.8f} {2}; {3:.2f}% over 24 hours on {4:.3f} {2} volume".format(coin, last, pair, change, vol*last))
found = True
if found == False:
bot.say("This shit is too shitty even for shitopia")
except: except:
bot.say("Error retrieving data from Cryptopia") bot.say("Error retrieving data from Cryptopia")
@sopel.module.commands('cmc', 'coinmarketcap') @sopel.module.commands('cmc', 'coinmarketcap')
def cmc(bot, trigger): def cmc(bot, trigger):
try: try:
r = requests.get('https://api.coinmarketcap.com/v1/ticker?limit=100') r = requests.get('https://api.coinmarketcap.com/v1/ticker?limit=500')
j = r.json() j = r.json()
except: except:
bot.say("Can't connect to API") bot.say("Can't connect to API")
if not trigger.group(2): if not trigger.group(2):
symbol = 'XMR' symbol = 'XMR'
else:
if trigger.group(2).isdigit():
rank = trigger.group(2)
elif trigger.group(2) == 'random':
rank = random.randint(1,500)
else: else:
symbol = trigger.group(2) symbol = trigger.group(2)
symbol = symbol.upper() symbol = symbol.upper()
try: try:
for i in j: for i in j:
try:
if i['symbol'] == symbol: if i['symbol'] == symbol:
name = i['name'] coin = i
rank = i['rank'] except: pass
price_usd = float(i['price_usd']) try:
price_btc = float(i['price_btc']) if i['rank'] == str(rank):
volume_usd = float(i['24h_volume_usd']) coin = i
market_cap_usd = float(i['market_cap_usd']) except: pass
available_supply = float(i['available_supply']) symbol = coin['symbol']
total_supply = float(i['total_supply']) name = coin['name']
percent_change_24h = float(i['percent_change_24h']) rank = coin['rank']
price_usd = float(coin['price_usd'])
price_btc = float(coin['price_btc'])
volume_usd = float(coin['24h_volume_usd'])
market_cap_usd = float(coin['market_cap_usd'])
available_supply = float(coin['available_supply'])
total_supply = float(coin['total_supply'])
percent_change_24h = float(coin['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)) 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: except:
bot.say("Error parsing ticker") bot.say("Error parsing ticker")
@ -566,3 +610,10 @@ def log(bot, trigger):
bot.say("Last price on c-cex for LOG at {0:.8f} BTC on {1:.3f} BTC volume.".format(last, vol)) bot.say("Last price on c-cex for LOG at {0:.8f} BTC on {1:.3f} BTC volume.".format(last, vol))
except: except:
bot.say("C-cex sucks") bot.say("C-cex sucks")
@sopel.module.commands('price')
def price(bot, trigger):
try:
bot.say("1 XMR = $1000 USD (Offer valid in participating locations)")
except:
bot.say("C-cex sucks")

BIN
price.pyc Normal file

Binary file not shown.

45
stock.py Normal file
View File

@ -0,0 +1,45 @@
# Copyright (C) 2013 - Russell Bryant
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
import urllib
import re
import sys
from sopel import module
def get_quote(symbol):
url = 'http://finance.google.com/finance?q=%s' % symbol
content = urllib.urlopen(url).read()
m = re.search('id="ref_(.*?)">(.*?)<', content)
if m:
quote = m.group(2)
else:
quote = 'no quote available for: "%s"' % symbol
return quote
m = re.search('class="chg" id="ref_\d+_c">(.*?)<', content)
if m:
quote += ' | %s' % m.group(1)
m = re.search('class="chg" id="ref_\d+_cp">(.*?)<', content)
if m:
quote += ' | %s' % m.group(1)
return quote
def quote(bot, input):
symbol = input.group(2)
bot.say(get_quote(symbol))
quote.commands = ['quote']

BIN
stock.pyc Normal file

Binary file not shown.

View File

@ -5,10 +5,18 @@ import re
import requests import requests
import praw import praw
@sopel.module.commands('4matter')
def fourmatter(bot, trigger):
bot.say('Irish I be fookin <3 Milo')
@sopel.module.commands('aminorex') @sopel.module.commands('aminorex')
def aminorex(bot, trigger): def aminorex(bot, trigger):
bot.say('if i could replace my wife with a robot... i might seriously think about it') bot.say('if i could replace my wife with a robot... i might seriously think about it')
@sopel.module.commands('ayylmao', 'lmao')
def lmao(bot, trigger):
bot.say('https://i.redd.it/jjiwl9dbejoy.jpg')
@sopel.module.commands('banana') @sopel.module.commands('banana')
def banana(bot, trigger): def banana(bot, trigger):
bot.say('(') bot.say('(')
@ -22,9 +30,13 @@ 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') 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') @sopel.module.commands('bear')
def banana(bot, trigger): def bear(bot, trigger):
bot.say(u'ʕ ·(エ)· ʔ'.encode('utf8')) bot.say(u'ʕ ·(エ)· ʔ'.encode('utf8'))
@sopel.module.commands('brothers')
def brothers(bot, trigger):
bot.say(u'http://www.trollaxor.com/2011/11/brief-history-of-ascii-penis.html'.encode('utf8'))
@sopel.module.commands('buyorsell') @sopel.module.commands('buyorsell')
def buyorsell(bot, trigger): def buyorsell(bot, trigger):
draw = random.random() draw = random.random()
@ -73,13 +85,21 @@ def ded(bot, trigger):
bot.say('https://imgur.com/a/yzNZW') bot.say('https://imgur.com/a/yzNZW')
@sopel.module.commands('donate', 'donation') @sopel.module.commands('donate', 'donation')
def dash(bot, trigger): def donate(bot, trigger):
bot.say('45SkxgDmcLmW5ByS7w9AG78JuJRvCoVKCdGJWnd4US95CBUAtvdGAdM2oHgZgTGjkEAUcwdqcryM819aqdeiKxHSQC8HkmS', trigger.nick) bot.say('45SkxgDmcLmW5ByS7w9AG78JuJRvCoVKCdGJWnd4US95CBUAtvdGAdM2oHgZgTGjkEAUcwdqcryM819aqdeiKxHSQC8HkmS', trigger.nick)
@sopel.module.commands('dump')
def dump(bot, trigger):
bot.say('https://www.youtube.com/watch?v=RHg8qIKJo1I')
@sopel.module.commands('eth') @sopel.module.commands('eth')
def eth(bot, trigger): def eth(bot, trigger):
bot.say(u'The world computer 💻🌐'.encode('utf8')) bot.say(u'The world computer 💻🌐'.encode('utf8'))
@sopel.module.commands('fib', 'fibonacci')
def fib(bot, trigger):
bot.say(u'Pardon me, do you have a moment to discuss our lord and savior ✞Cheesus Monero✞?'.encode('utf8'))
@sopel.module.commands('flip') @sopel.module.commands('flip')
def flip(bot, trigger): def flip(bot, trigger):
bot.say(u'(╯°□°)╯︵ ┻━┻'.encode('utf8')) bot.say(u'(╯°□°)╯︵ ┻━┻'.encode('utf8'))
@ -94,10 +114,26 @@ fuckyouoptions = [
def fuckyou(bot, trigger): def fuckyou(bot, trigger):
bot.say(random.choice(fuckyouoptions)) bot.say(random.choice(fuckyouoptions))
@sopel.module.commands('gay')
def gay(bot, trigger):
bot.say('https://i.imgur.com/RHbXrLa.png')
@sopel.module.commands('gui') @sopel.module.commands('gui')
def gui(bot, trigger): def gui(bot, trigger):
bot.say('http://imgur.com/a/hnxfS') bot.say('http://imgur.com/a/hnxfS')
@sopel.module.commands('hmm', 'hmmm')
def hmm(bot, trigger):
try:
sub=reddit.get_subreddit('hmmm')
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('isittrue') @sopel.module.commands('isittrue')
def isittrue(bot, trigger): def isittrue(bot, trigger):
draw = random.random() draw = random.random()
@ -114,13 +150,21 @@ def jaxx(bot, trigger):
bot.say(u'This command will be implemented soon. Honest. Especially if the devs can provide some unpaid assistance. Soon™...') bot.say(u'This command will be implemented soon. Honest. Especially if the devs can provide some unpaid assistance. Soon™...')
@sopel.module.commands('joshua1234') @sopel.module.commands('joshua1234')
def jaxx(bot, trigger): def joshua(bot, trigger):
bot.say(u'The first, second, third, and fourth amongst joshes.') bot.say(u'The first, second, third, and fourth amongst joshes.')
@sopel.module.commands('jwinterm')
def jwinterm(bot, trigger):
bot.say(u'j_winter_m')
@sopel.module.commands('lenny') @sopel.module.commands('lenny')
def lenny(bot, trigger): def lenny(bot, trigger):
bot.say(u'( ͡° ͜ʖ ͡°)'.encode('utf8')) bot.say(u'( ͡° ͜ʖ ͡°)'.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('masternode', 'masternodes') @sopel.module.commands('masternode', 'masternodes')
def masternode(bot, trigger): def masternode(bot, trigger):
bot.say('http://hadoopilluminated.com/hadoop_illuminated/images/hdfs3.jpg') bot.say('http://hadoopilluminated.com/hadoop_illuminated/images/hdfs3.jpg')
@ -141,24 +185,37 @@ def nomnomnom(bot, trigger):
def noom(bot, trigger): def noom(bot, trigger):
bot.say(u'┏(.0.)┓'.encode('utf8')) bot.say(u'┏(.0.)┓'.encode('utf8'))
odboptions = [
"FBI don't you be watching me",
"Ooo baby I like it raw",
"Jacques Cousteau could never get this low"
]
@sopel.module.commands('odb', 'oldirty')
def odb(bot, trigger):
bot.say(random.choice(confirmoptions))
perooptions = [
'https://www.youtube.com/watch?v=QqreRufrkxM',
'https://www.youtube.com/watch?v=ZnPrtiLy0uU'
]
@sopel.module.commands('pero') @sopel.module.commands('pero')
def pero(bot, trigger): def pero(bot, trigger):
bot.say('https://www.youtube.com/watch?v=QqreRufrkxM') bot.say(random.choice(perooptions))
@sopel.module.commands('pivx')
def pivc(bot, trigger):
bot.say("Masternodes + PoS...what could possibly go wrong?")
confirmoptions = [
"I can confirm that it is true",
"This is true",
"Fake news",
"Alternative fact",
"The outlook is murky, ask again later"
]
@sopel.module.commands('pleaseconfirm', 'confirm') @sopel.module.commands('pleaseconfirm', 'confirm')
def confirm(bot, trigger): def confirm(bot, trigger):
draw = random.random() bot.say(random.choice(confirmoptions))
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') @sopel.module.commands('rarepepe', 'rare')
def rarepepe(bot, trigger): def rarepepe(bot, trigger):
@ -239,6 +296,10 @@ def tinytrump(bot, trigger):
def trump(bot, trigger): def trump(bot, trigger):
bot.say("Monero is the best crypto, believe me, I know crypto and it's going to be yuuuuuuuge!") bot.say("Monero is the best crypto, believe me, I know crypto and it's going to be yuuuuuuuge!")
@sopel.module.commands('tumbleweed')
def trump(bot, trigger):
bot.say("https://rootco.de/2016-03-28-why-use-tumbleweed/")
@sopel.module.commands('unflip') @sopel.module.commands('unflip')
def unflip(bot, trigger): def unflip(bot, trigger):
bot.say(u'┬─┬ノ( º _ ºノ)'.encode('utf8')) bot.say(u'┬─┬ノ( º _ ºノ)'.encode('utf8'))
@ -254,19 +315,37 @@ urmomoptions = [
"ur momma has a glass eye with a fish in it", "ur momma has a glass eye with a fish in it",
"ur mama is so stupid she sold her romero for bitcoins", "ur mama is so stupid she sold her romero for bitcoins",
"ur momma look like a Simpsons character", "ur momma look like a Simpsons character",
"ur mom is Amanda B Johnson" "ur mom is so ugly Donald Trump wouldn't even grab her by the pussy",
"ur momma is so stupid she listens to rpietila",
"ur mom is Amanda B Johnson",
"US ur mom if u want to U!",
"ur mom is so stupid she thinks Craig Wright is Satoshi"
] ]
@sopel.module.commands('urmom', 'yourmom', 'yomom', 'yomomma') @sopel.module.commands('urmom', 'yourmom', 'yomom', 'yomomma')
def urmom(bot, trigger): def urmom(bot, trigger):
bot.say(random.choice(urmomoptions)) bot.say(random.choice(urmomoptions))
vitalikoptions = [
"https://pbs.twimg.com/media/CrWjczJXgAExF2S.jpg",
"mETH, not even once: https://cdn-az.allevents.in/banners/e7df519e0808bac49fa3aaf503aff87d",
"Betteridge's law of headlines: https://fortunedotcom.files.wordpress.com/2016/09/blo_startups_2520x1667.png"
]
@sopel.module.commands('vitalik', 'buterin')
def vitalik(bot, trigger):
bot.say(random.choice(vitalikoptions))
@sopel.module.commands('wat') @sopel.module.commands('wat')
def wat(bot, trigger): def wat(bot, trigger):
bot.say("https://www.destroyallsoftware.com/talks/wat") bot.say("https://www.destroyallsoftware.com/talks/wat")
zcashoptions = [
"Trust us guys, we totally smashed that computer up, with like...magnetic baseball bats.",
"https://youtu.be/A51Bl3jkF0c"
]
@sopel.module.commands('zec', 'zcash') @sopel.module.commands('zec', 'zcash')
def zcash(bot, trigger): def zcash(bot, trigger):
bot.say('Trust us guys, we totally smashed that computer up, with like...magnetic baseball bats.') bot.say(random.choice(zcashoptions))
@sopel.module.rule('monerobux o\/') @sopel.module.rule('monerobux o\/')
def wave(bot, trigger): def wave(bot, trigger):

BIN
trifling.pyc Normal file

Binary file not shown.