diff --git a/network.py b/network.py index 5e24c90..65f875e 100644 --- a/network.py +++ b/network.py @@ -4,6 +4,20 @@ import re 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') def network(bot, trigger): try: @@ -41,7 +55,7 @@ def mempool(bot, trigger): def blocksize(bot, trigger): try: r=requests.get('http://moneroblocks.info/stats/block-medians') - size=re.search(' <\/strong><\/div>\s*
(\d*)', r.text) + size=re.search(' <\/strong><\/div>\s*
(\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") diff --git a/network.pyc b/network.pyc new file mode 100644 index 0000000..2648551 Binary files /dev/null and b/network.pyc differ diff --git a/price.py b/price.py index a918c93..1b714e9 100644 --- a/price.py +++ b/price.py @@ -2,12 +2,13 @@ import sopel.module import requests import time +import random 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" +cryptopiaurl = "https://www.cryptopia.co.nz/api/GetMarkets" 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' @@ -17,6 +18,7 @@ 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' +krakusdt = 'http://api.kraken.com/0/public/Ticker?pair=USDTUSD' @sopel.module.commands('bfx', 'bitfinex') def bfx(bot, trigger): @@ -64,6 +66,16 @@ def krak(bot, trigger): except: 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') def krakeur(bot, trigger): stringtosay = '' @@ -128,6 +140,8 @@ def polo(bot, trigger): # bot.say("COBOL only in #monero-markets") # elif coin == "NAUT": # bot.say("That ship has sailed...") + elif coin == "PIVX": + bot.say("Masternodes + PoS...what could possibly go wrong?") else: label="BTC_" + coin try: @@ -193,40 +207,70 @@ def bsq(bot, trigger): @sopel.module.commands('cryptopia') def cryptopia(bot, trigger): 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) 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)) + found = False + for i in j["Data"]: + if i["Label"] == coin+"/"+pair: + last=float(i['LastPrice']) + 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: 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') + r = requests.get('https://api.coinmarketcap.com/v1/ticker?limit=500') 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() + if trigger.group(2).isdigit(): + rank = trigger.group(2) + elif trigger.group(2) == 'random': + rank = random.randint(1,500) + 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']) + try: + if i['symbol'] == symbol: + coin = i + except: pass + try: + if i['rank'] == str(rank): + coin = i + except: pass + symbol = coin['symbol'] + name = coin['name'] + 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)) except: 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)) except: 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") diff --git a/price.pyc b/price.pyc new file mode 100644 index 0000000..fca9441 Binary files /dev/null and b/price.pyc differ diff --git a/stock.py b/stock.py new file mode 100644 index 0000000..60cae57 --- /dev/null +++ b/stock.py @@ -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'] diff --git a/stock.pyc b/stock.pyc new file mode 100644 index 0000000..762d848 Binary files /dev/null and b/stock.pyc differ diff --git a/trifling.py b/trifling.py index f439fd9..ce0416d 100644 --- a/trifling.py +++ b/trifling.py @@ -5,10 +5,18 @@ import re import requests import praw +@sopel.module.commands('4matter') +def fourmatter(bot, trigger): + bot.say('Irish I be fookin <3 Milo') + @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('ayylmao', 'lmao') +def lmao(bot, trigger): + bot.say('https://i.redd.it/jjiwl9dbejoy.jpg') + @sopel.module.commands('banana') def banana(bot, trigger): 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') @sopel.module.commands('bear') -def banana(bot, trigger): +def bear(bot, trigger): 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') def buyorsell(bot, trigger): draw = random.random() @@ -73,13 +85,21 @@ def ded(bot, trigger): bot.say('https://imgur.com/a/yzNZW') @sopel.module.commands('donate', 'donation') -def dash(bot, trigger): +def donate(bot, trigger): 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') def eth(bot, trigger): 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') def flip(bot, trigger): bot.say(u'(╯°□°)╯︵ ┻━┻'.encode('utf8')) @@ -94,10 +114,26 @@ fuckyouoptions = [ def fuckyou(bot, trigger): 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') def gui(bot, trigger): 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') def isittrue(bot, trigger): 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™...') @sopel.module.commands('joshua1234') -def jaxx(bot, trigger): +def joshua(bot, trigger): 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') def lenny(bot, trigger): 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') def masternode(bot, trigger): bot.say('http://hadoopilluminated.com/hadoop_illuminated/images/hdfs3.jpg') @@ -141,24 +185,37 @@ def nomnomnom(bot, trigger): def noom(bot, trigger): 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') 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') 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) + bot.say(random.choice(confirmoptions)) @sopel.module.commands('rarepepe', 'rare') def rarepepe(bot, trigger): @@ -239,6 +296,10 @@ def tinytrump(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!") +@sopel.module.commands('tumbleweed') +def trump(bot, trigger): + bot.say("https://rootco.de/2016-03-28-why-use-tumbleweed/") + @sopel.module.commands('unflip') def unflip(bot, trigger): bot.say(u'┬─┬ノ( º _ ºノ)'.encode('utf8')) @@ -254,19 +315,37 @@ urmomoptions = [ "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" +"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') def urmom(bot, trigger): 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') def wat(bot, trigger): 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') 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\/') def wave(bot, trigger): diff --git a/trifling.pyc b/trifling.pyc new file mode 100644 index 0000000..9e703a3 Binary files /dev/null and b/trifling.pyc differ