From 3dfbf7f3793f101bc6b98d5e33072cbd77c15cdb Mon Sep 17 00:00:00 2001 From: anonimal Date: Fri, 17 Nov 2017 22:11:48 +0000 Subject: [PATCH 01/33] price: s/bcc/bch/g --- price.py | 6 +++--- test.py | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/price.py b/price.py index 2442274..91615ad 100644 --- a/price.py +++ b/price.py @@ -27,9 +27,9 @@ thumbxmrurl = 'https://api.bithumb.com/public/ticker/xmr' # measured natively in thumbbtcurl = 'https://api.bithumb.com/public/ticker/btc' # measured natively in KRW -@sopel.module.commands('bcc', 'bitcointrash') -def bcc(bot, trigger): - url = 'https://api.coinmarketcap.com/v1/ticker/?bcc' +@sopel.module.commands('bch', 'bitcointrash') +def bch(bot, trigger): + url = 'https://api.coinmarketcap.com/v1/ticker/?bch' try: r = requests.get(url) j = r.json() diff --git a/test.py b/test.py index 0cea6e4..3931364 100644 --- a/test.py +++ b/test.py @@ -1,7 +1,7 @@ import requests -url = 'https://api.coinmarketcap.com/v1/ticker/?bcc' +url = 'https://api.coinmarketcap.com/v1/ticker/?bch' r = requests.get(url) j = r.json() From 7a1116f9a0d6fef837f62d8b754835715bbd2201 Mon Sep 17 00:00:00 2001 From: scoobybejesus Date: Fri, 24 Nov 2017 22:42:26 -0500 Subject: [PATCH 02/33] hotline gif and deathtobitcoin2 "Devs pay me plus interest!!" --- trifling.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/trifling.py b/trifling.py index f500adf..00f8941 100644 --- a/trifling.py +++ b/trifling.py @@ -82,6 +82,10 @@ def dash(bot, trigger): @sopel.module.commands('dealwithit') def dealwithit(bot, trigger): bot.say(u'(•_•) ( •_•)>⌐■-■ (⌐■_■)'.encode('utf8')) + +@sopel.module.commands('Deathtobitcoin', 'Deathtobitcoin2', 'deathtobitcoin', 'deathtobitcoin2') +def deathtobitcoin2(bot, trigger): + bot.say('Devs, moderators, whoever you fucking are, please put my money back with interest. Or make my money appear in my wallet with interest!') @sopel.module.commands('diiorio') def diiorio(bot, trigger): @@ -171,7 +175,10 @@ def hero(bot, trigger): @sopel.module.commands('hotline') def hotline(bot, trigger): - bot.say(u'☎ Call 1-800-273-8255 to reach the National Suicide Prevention Lifeline ☎' .encode('utf8')) + if random.random() > 0.3: + bot.say(u'☎ Call 1-800-273-8255 to reach the National Suicide Prevention Lifeline ☎' .encode('utf8')) + else: + bot.say('http://pixel.nymag.com/imgs/daily/vulture/2015/10/20/drake-dance/drake-4.w529.h352.gif') @sopel.module.commands('invest') def invest(bot, trigger): From 5676c98e0afd351c69aed4b62ff6dbf8ec87f73f Mon Sep 17 00:00:00 2001 From: scoobybejesus Date: Thu, 7 Dec 2017 15:45:19 -0500 Subject: [PATCH 03/33] Remove duplicate (case doesn't matter, apparently) --- trifling.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/trifling.py b/trifling.py index 00f8941..6285422 100644 --- a/trifling.py +++ b/trifling.py @@ -83,7 +83,7 @@ def dash(bot, trigger): def dealwithit(bot, trigger): bot.say(u'(•_•) ( •_•)>⌐■-■ (⌐■_■)'.encode('utf8')) -@sopel.module.commands('Deathtobitcoin', 'Deathtobitcoin2', 'deathtobitcoin', 'deathtobitcoin2') +@sopel.module.commands('Deathtobitcoin', 'Deathtobitcoin2') def deathtobitcoin2(bot, trigger): bot.say('Devs, moderators, whoever you fucking are, please put my money back with interest. Or make my money appear in my wallet with interest!') From e8a782464c41df9a8073f42646e37a931f7f2e69 Mon Sep 17 00:00:00 2001 From: scoobybejesus Date: Mon, 1 Jan 2018 22:59:15 -0500 Subject: [PATCH 04/33] cmc top whatever (limited to 20) --- price.py | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/price.py b/price.py index 7ddfe14..5a29139 100644 --- a/price.py +++ b/price.py @@ -361,6 +361,43 @@ def cmc(bot, trigger): except: bot.say("Error parsing ticker") +@sopel.module.commands('top') +def cmc(bot, trigger): + if not trigger.group(2): + bot.say("You want to see the CMC top... how many? Pick a number 1 through 20") + else: + if type(trigger.group(2)) in (float, int): + limit = float(trigger.group(2)) + mylist = range(1,limit + 1) + if limit > 20: + bot.say("Too high! Max is 20!") + else if limit < 1: + bot.say("Dude...") + else: + try: + r = requests.get('https://api.coinmarketcap.com/v1/ticker?limit=500') + j = r.json() + except: + bot.say("Can't connect to API") + try: + for therank in mylist: + for i in j: + try: + if i['rank'] == str(therank): + 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']) + topXstring += "{0}. ({1}) - {2}: Last price ${3:.2f} / ฿{4:.6f} | ".format(rank, symbol, name, price_usd, price_btc) + bot.say(topXstring) + except: + bot.say("Error parsing ticker, or maybe double check the code") + else: + bot.say("The use is 'top' and then a digit 1 - 20") + @sopel.module.commands('okc', 'okcoin') def okc(bot, trigger): try: From 66e378b8cae8df5311c310ddba4c05fcfd2dc22a Mon Sep 17 00:00:00 2001 From: scoobybejesus Date: Tue, 2 Jan 2018 00:07:47 -0500 Subject: [PATCH 05/33] top 10 cmc; short descr. --- price.py | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/price.py b/price.py index 5a29139..b964c24 100644 --- a/price.py +++ b/price.py @@ -3,6 +3,7 @@ import sopel.module import requests import time import random +import math # from apikey import commodity_key polourl = "https://poloniex.com/public?command=returnTicker" @@ -362,20 +363,20 @@ def cmc(bot, trigger): bot.say("Error parsing ticker") @sopel.module.commands('top') -def cmc(bot, trigger): +def top(bot, trigger): if not trigger.group(2): - bot.say("You want to see the CMC top... how many? Pick a number 1 through 20") + bot.say("You want to see the CMC top... how many? Pick a number 1 through 10") else: if type(trigger.group(2)) in (float, int): limit = float(trigger.group(2)) mylist = range(1,limit + 1) - if limit > 20: - bot.say("Too high! Max is 20!") + if limit > 10: + bot.say("Too high! Max is 10!") else if limit < 1: bot.say("Dude...") else: try: - r = requests.get('https://api.coinmarketcap.com/v1/ticker?limit=500') + r = requests.get('https://api.coinmarketcap.com/v1/ticker?limit=50') j = r.json() except: bot.say("Can't connect to API") @@ -391,12 +392,18 @@ def cmc(bot, trigger): rank = coin['rank'] price_usd = float(coin['price_usd']) price_btc = float(coin['price_btc']) - topXstring += "{0}. ({1}) - {2}: Last price ${3:.2f} / ฿{4:.6f} | ".format(rank, symbol, name, price_usd, price_btc) + market_cap_usd = float(coin['market_cap_usd']) + if market_cap_usd >= 1000000000: + market_cap_short = int(round(market_cap_usd,-9)/1000000000 + rounded_mcap = str(market_cap_short)+"B" + else: + rounded_mcap = "tiny" + topXstring += "{0}. {1} ${2} | ".format(rank, symbol, rounded_mcap) #TODO: add price_usd, rounded bot.say(topXstring) except: bot.say("Error parsing ticker, or maybe double check the code") else: - bot.say("The use is 'top' and then a digit 1 - 20") + bot.say("The use is 'top' and then a digit 1 - 10") @sopel.module.commands('okc', 'okcoin') def okc(bot, trigger): From 553871da821389e7708600c19222365d75d9d29d Mon Sep 17 00:00:00 2001 From: scoobybejesus Date: Tue, 2 Jan 2018 00:08:49 -0500 Subject: [PATCH 06/33] cmc top 10 --- price.py | 1 - 1 file changed, 1 deletion(-) diff --git a/price.py b/price.py index b964c24..db6309e 100644 --- a/price.py +++ b/price.py @@ -3,7 +3,6 @@ import sopel.module import requests import time import random -import math # from apikey import commodity_key polourl = "https://poloniex.com/public?command=returnTicker" From d15a3d5a8ac4f62a8878234c00e96dc601570ef9 Mon Sep 17 00:00:00 2001 From: root Date: Tue, 2 Jan 2018 05:18:11 +0000 Subject: [PATCH 07/33] update before pull --- network.py | 12 +++++++++++ price.py | 60 +++++++++++++++++++++++++++++++++++++++-------------- trifling.py | 6 ++++++ 3 files changed, 63 insertions(+), 15 deletions(-) diff --git a/network.py b/network.py index efd0e08..b0c5854 100644 --- a/network.py +++ b/network.py @@ -76,6 +76,18 @@ def mine(bot, trigger): except: bot.say("Mining is for suckers.") +@sopel.module.commands('solo') +def solo(bot, trigger): + try: + r=requests.get('https://supportxmr.com/api/network/stats') + j=r.json() + diff=float(j['difficulty']) + hashrate=float(trigger.group(2)) + timetoblock=(diff/hashrate) + bot.say("At {:.0f} h/s with network diff of {:.2e} your expected time for find a block is {:.2e} s or {:.2f} days.".format(hashrate, diff, timetoblock, timetoblock/(60*60*24))) + except: + bot.say("Mining is for suckers.") + @sopel.module.commands('b2x') def b2x(bot, trigger): bot.say("Fuck off \\x") diff --git a/price.py b/price.py index 7ddfe14..6068b8c 100644 --- a/price.py +++ b/price.py @@ -26,26 +26,22 @@ bitflyerurl = 'https://api.bitflyer.jp/v1/ticker' thumbxmrurl = 'https://api.bithumb.com/public/ticker/xmr' # measured natively in KRW thumbbtcurl = 'https://api.bithumb.com/public/ticker/btc' # measured natively in KRW - -@sopel.module.commands('bch', 'bitcointrash') -def bch(bot, trigger): +@sopel.module.commands('forksum') +def forksum(bot, trigger): url = 'https://api.coinmarketcap.com/v1/ticker/?bch' try: r = requests.get(url) j = r.json() for i in j: try: + if i['id'] == 'bitcoin': + btcprice = float(i['price_usd']) if i['id'] == 'bitcoin-cash': - coin = i + bcashprice = float(i['price_usd']) + if i['id'] == 'bitcoin-gold': + bgoldprice = float(i['price_usd']) 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']) - 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}%.".format(name, symbol, rank, price_usd, price_btc, volume_usd, percent_change_24h)) + bot.say("The sum of USD price of BTC, BCH, and BTG is ${:.2f}".format(btcprice+bcashprice+bgoldprice)) except: bot.say("Error parsing ticker") @@ -475,10 +471,12 @@ def tall(bot, trigger): try: gdaxresult = requests.get(gdaxurl) gdaxjson = gdaxresult.json() + gdaxprice = float(gdaxjson['price']) + gdaxvolume = float(gdaxjson['volume']) except: gdaxjson = False if gdaxjson: - stringtosend += "GDAX price: {0:,.2f}, vol: {1:,.1f} | ".format(float(gdaxjson['price']), float(gdaxjson['volume'])) + stringtosend += "GDAX price: {0:,.2f}, vol: {1:,.1f} | ".format(gdaxprice, gdaxvolume) # Bitfinex try: finexresult = requests.get(finexurl) @@ -525,7 +523,7 @@ def tall(bot, trigger): bot.say(stringtosend) -@sopel.module.commands('xmrtall') +@sopel.module.commands('xmrtall', 'xmr') def xmrtall(bot, trigger): stringtosend = '' @@ -882,7 +880,7 @@ def log(bot, trigger): @sopel.module.commands('price') def price(bot, trigger): try: - bot.say("1 XMR = $1,000 USD (Offer valid in participating locations)") + bot.say("1 XMR = $12,345 USD (Offer valid in participating locations)") except: bot.say("C-cex sucks") @@ -910,3 +908,35 @@ def commodity(bot, trigger): except: bot.say("Monerobux fails again...") +@sopel.module.commands('xmy') +def xmy(bot, trigger): + try: + r = requests.get('https://api.coinmarketcap.com/v1/ticker?limit=500') + j = r.json() + except: + bot.say("Can't connect to API") + symbol = 'XMY' + try: + for i in j: + 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") + diff --git a/trifling.py b/trifling.py index f53ead1..a553e28 100644 --- a/trifling.py +++ b/trifling.py @@ -11,6 +11,12 @@ from threading import Timer def fourmatter(bot, trigger): bot.say('Irish I be fookin <3 Milo') +@sopel.module.commands('allah') +def allah(bot, trigger): + bot.say('allah is doing') + bot.say('sun is not doing allah is doing') + bot.say('to accept Islam say that i bear witness that there is no deity worthy of worship except Allah and Muhammad peace be upon him is his slave and messenger') + @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') From 624c3b498a25099d161c860bcf0233584a799de9 Mon Sep 17 00:00:00 2001 From: scoobybejesus Date: Tue, 2 Jan 2018 22:25:54 -0500 Subject: [PATCH 08/33] fix 'top' bug --- price.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/price.py b/price.py index 549eb2c..d7a8e37 100644 --- a/price.py +++ b/price.py @@ -367,7 +367,7 @@ def top(bot, trigger): mylist = range(1,limit + 1) if limit > 10: bot.say("Too high! Max is 10!") - else if limit < 1: + elif limit < 1: bot.say("Dude...") else: try: @@ -389,7 +389,7 @@ def top(bot, trigger): price_btc = float(coin['price_btc']) market_cap_usd = float(coin['market_cap_usd']) if market_cap_usd >= 1000000000: - market_cap_short = int(round(market_cap_usd,-9)/1000000000 + market_cap_short = int(int(round(market_cap_usd,-9))/int(1000000000)) rounded_mcap = str(market_cap_short)+"B" else: rounded_mcap = "tiny" From b134ca362557419e20591153d3f2e5de7c251d4b Mon Sep 17 00:00:00 2001 From: root Date: Wed, 3 Jan 2018 15:36:00 +0000 Subject: [PATCH 09/33] fix git --- price.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/price.py b/price.py index d7a8e37..3305cbf 100644 --- a/price.py +++ b/price.py @@ -319,7 +319,7 @@ def cryptopia(bot, trigger): @sopel.module.commands('cmc', 'coinmarketcap') def cmc(bot, trigger): try: - r = requests.get('https://api.coinmarketcap.com/v1/ticker?limit=500') + r = requests.get('https://api.coinmarketcap.com/v1/ticker?limit=1000') j = r.json() except: bot.say("Can't connect to API") @@ -329,7 +329,7 @@ def cmc(bot, trigger): if trigger.group(2).isdigit(): rank = trigger.group(2) elif trigger.group(2) == 'random': - rank = random.randint(1,500) + rank = random.randint(1,1000) else: symbol = trigger.group(2) symbol = symbol.upper() @@ -363,7 +363,7 @@ def top(bot, trigger): bot.say("You want to see the CMC top... how many? Pick a number 1 through 10") else: if type(trigger.group(2)) in (float, int): - limit = float(trigger.group(2)) + limit = int(trigger.group(2)) mylist = range(1,limit + 1) if limit > 10: bot.say("Too high! Max is 10!") From 8298297c37a2e771316a0d64574bf34ed0052600 Mon Sep 17 00:00:00 2001 From: root Date: Wed, 3 Jan 2018 15:58:02 +0000 Subject: [PATCH 10/33] top working now --- price.py | 66 +++++++++++++++++++++++++------------------------------- 1 file changed, 29 insertions(+), 37 deletions(-) diff --git a/price.py b/price.py index 3305cbf..d2f8315 100644 --- a/price.py +++ b/price.py @@ -362,43 +362,35 @@ def top(bot, trigger): if not trigger.group(2): bot.say("You want to see the CMC top... how many? Pick a number 1 through 10") else: - if type(trigger.group(2)) in (float, int): - limit = int(trigger.group(2)) - mylist = range(1,limit + 1) - if limit > 10: - bot.say("Too high! Max is 10!") - elif limit < 1: - bot.say("Dude...") - else: - try: - r = requests.get('https://api.coinmarketcap.com/v1/ticker?limit=50') - j = r.json() - except: - bot.say("Can't connect to API") - try: - for therank in mylist: - for i in j: - try: - if i['rank'] == str(therank): - 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']) - market_cap_usd = float(coin['market_cap_usd']) - if market_cap_usd >= 1000000000: - market_cap_short = int(int(round(market_cap_usd,-9))/int(1000000000)) - rounded_mcap = str(market_cap_short)+"B" - else: - rounded_mcap = "tiny" - topXstring += "{0}. {1} ${2} | ".format(rank, symbol, rounded_mcap) #TODO: add price_usd, rounded - bot.say(topXstring) - except: - bot.say("Error parsing ticker, or maybe double check the code") - else: - bot.say("The use is 'top' and then a digit 1 - 10") + try: + limit = int(trigger.group(2)) + if limit > 10: + bot.say("Too high! Max is 10!") + elif limit < 1: + bot.say("Dude...") + else: + try: + r = requests.get('https://api.coinmarketcap.com/v1/ticker?limit={}'.format(limit)) + j = r.json() + except: + bot.say("Can't connect to API") + topXstring = "" + for i in j: + symbol = i['symbol'] + name = i['name'] + rank = i['rank'] + price_usd = float(i['price_usd']) + price_btc = float(i['price_btc']) + market_cap_usd = float(i['market_cap_usd']) + if market_cap_usd >= 1000000000: + market_cap_short = int(int(round(market_cap_usd,-9))/int(1000000000)) + rounded_mcap = str(market_cap_short)+"B" + else: + rounded_mcap = "tiny" + topXstring += "{0}. {1} ${2} | ".format(rank, symbol, rounded_mcap) #TODO: add price_usd, rounded + bot.say(topXstring) + except: + bot.say("The use is 'top' and then a digit 1 - 10") @sopel.module.commands('okc', 'okcoin') def okc(bot, trigger): From b0a5d039ec0963843787ee66d3bf85e9742996c7 Mon Sep 17 00:00:00 2001 From: root Date: Wed, 3 Jan 2018 16:01:13 +0000 Subject: [PATCH 11/33] change top to 20 --- price.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/price.py b/price.py index d2f8315..fd9038c 100644 --- a/price.py +++ b/price.py @@ -360,12 +360,12 @@ def cmc(bot, trigger): @sopel.module.commands('top') def top(bot, trigger): if not trigger.group(2): - bot.say("You want to see the CMC top... how many? Pick a number 1 through 10") + bot.say("You want to see the CMC top... how many? Pick a number 1 through 20") else: try: limit = int(trigger.group(2)) - if limit > 10: - bot.say("Too high! Max is 10!") + if limit > 20: + bot.say("Too high! Max is 20!") elif limit < 1: bot.say("Dude...") else: @@ -390,7 +390,7 @@ def top(bot, trigger): topXstring += "{0}. {1} ${2} | ".format(rank, symbol, rounded_mcap) #TODO: add price_usd, rounded bot.say(topXstring) except: - bot.say("The use is 'top' and then a digit 1 - 10") + bot.say("The use is 'top' and then a digit 1 - 20") @sopel.module.commands('okc', 'okcoin') def okc(bot, trigger): From c5035e6b388b7765afeecce2ae7e34e24229c411 Mon Sep 17 00:00:00 2001 From: scoobybejesus Date: Thu, 4 Jan 2018 10:00:15 -0500 Subject: [PATCH 12/33] Round top for >100B --- price.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/price.py b/price.py index fd9038c..7a46f94 100644 --- a/price.py +++ b/price.py @@ -383,7 +383,10 @@ def top(bot, trigger): price_btc = float(i['price_btc']) market_cap_usd = float(i['market_cap_usd']) if market_cap_usd >= 1000000000: - market_cap_short = int(int(round(market_cap_usd,-9))/int(1000000000)) + if market_cap_usd >= 100000000000: + market_cap_short = int(int(round(market_cap_usd,-9))/int(1000000000)) + else: + market_cap_short = float(int(round(market_cap_usd,-8))/int(1000000000)) rounded_mcap = str(market_cap_short)+"B" else: rounded_mcap = "tiny" From 7ae280e854060716da51f7544021f57976808b92 Mon Sep 17 00:00:00 2001 From: root Date: Thu, 11 Jan 2018 04:43:56 +0000 Subject: [PATCH 13/33] update cmc --- price.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/price.py b/price.py index fd9038c..2dd60aa 100644 --- a/price.py +++ b/price.py @@ -318,6 +318,9 @@ def cryptopia(bot, trigger): @sopel.module.commands('cmc', 'coinmarketcap') def cmc(bot, trigger): + if trigger.group(2).lower() == 'trx': + bot.say("Fuck off with your scams scammer") + return try: r = requests.get('https://api.coinmarketcap.com/v1/ticker?limit=1000') j = r.json() From 4e05ccdc519a6b0f930a2e1a413ac54e819d242d Mon Sep 17 00:00:00 2001 From: scoobybejesus Date: Tue, 23 Jan 2018 18:58:45 -0500 Subject: [PATCH 14/33] Remove extraneous unused code --- price.py | 42 ------------------------------------------ 1 file changed, 42 deletions(-) diff --git a/price.py b/price.py index 9c20839..9d942eb 100644 --- a/price.py +++ b/price.py @@ -100,31 +100,10 @@ def krak(bot, trigger): stringtosay += "{0} at {1:.8f} on {2:.2f} 24 h {0} volume. ".format(coin, float(j['result']['X'+str(coin)+'XXBT']['c'][0]), float(j['result']['X'+str(coin)+'XXBT']['v'][1])) except: bot.say("Error connecting to Kraken") -# if len(coin) > 5 or len(coin) < 2: -# bot.say("Coin ticker is too long or short") -# elif coin == "PIVX": -# bot.say("Masternodes + PoS...what could possibly go wrong?") -# else: try: bot.say(stringtosay) except: bot.say("Error getting data") - -# THIS WAS COPIED FROM THE POLO FUNCTION, AND IS UNUSED, AT LEAST FOR NOW -# 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('usdt') def usdt(bot, trigger): @@ -597,27 +576,6 @@ def xmrtall(bot, trigger): last=float(xmr['last']) # change=float(xmr['percentChange']) vol=float(xmr['baseVolume']) -# '''remove? -# 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') -# ''' stringtosend += "Poloniex last: {0:.6f} BTC on {1:.2f} BTC volume | ".format(last, vol) except: bot.say("Something borked ¯\(º_o)/¯") From a2a80267be50108f7c76627d9ee3458a9c1fa01c Mon Sep 17 00:00:00 2001 From: root Date: Wed, 24 Jan 2018 04:49:36 +0000 Subject: [PATCH 15/33] Binance added --- network.py | 5 ++-- price.py | 68 ++++++++++++++++++++++++++++++++++++++++-------------- 2 files changed, 54 insertions(+), 19 deletions(-) diff --git a/network.py b/network.py index b0c5854..cdc1ffb 100644 --- a/network.py +++ b/network.py @@ -2,7 +2,8 @@ import sopel.module import requests import re -networkurl = "http://node.xmrbackb.one:18081/getinfo" +# networkurl = "http://node.xmrbackb.one:18081/getinfo" +networkurl = "http://opennode.minemonero.pro:18081/getinfo" @sopel.module.commands('fork', 'forkening') def fork(bot, trigger): @@ -48,7 +49,7 @@ def btcmempool(bot, trigger): def mempool(bot, trigger): try: # r=requests.get('http://node.moneroworld.com:18081/getinfo') - r=requests.get('http://node.xmrbackb.one:18081/getinfo') + r=requests.get(networkurl) j=r.json() bot.say("The current number of txs in Monero's mempool is {0}".format(j['tx_pool_size'])) except: diff --git a/price.py b/price.py index 9c20839..bd0ca88 100644 --- a/price.py +++ b/price.py @@ -25,6 +25,7 @@ krakusdt = 'http://api.kraken.com/0/public/Ticker?pair=USDTUSD' bitflyerurl = 'https://api.bitflyer.jp/v1/ticker' thumbxmrurl = 'https://api.bithumb.com/public/ticker/xmr' # measured natively in KRW thumbbtcurl = 'https://api.bithumb.com/public/ticker/btc' # measured natively in KRW +binanceurl = 'https://api.binance.com/api/v1/ticker/24hr' @sopel.module.commands('forksum') def forksum(bot, trigger): @@ -286,6 +287,36 @@ def bsq(bot, trigger): except: bot.say("Error retrieving data from Bitsquare") +@sopel.module.commands('binance') +def binance(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(binanceurl) + j = r.json() + found = False + for i in j: + if i["symbol"] == coin+pair: + last=float(i['lastPrice']) + change=float(i['priceChangePercent']) + vol=float(i['volume']) + bot.say("{0} on Binance 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("Too scammy even for Binance") + except: + bot.say("Error retrieving data from Binance") + @sopel.module.commands('cryptopia', 'shitopia', 'topia', 'ctop') def cryptopia(bot, trigger): try: @@ -318,9 +349,12 @@ def cryptopia(bot, trigger): @sopel.module.commands('cmc', 'coinmarketcap') def cmc(bot, trigger): - if trigger.group(2).lower() == 'trx': - bot.say("Fuck off with your scams scammer") - return + # try: + # if trigger.group(2).lower() == 'trx': + # bot.say("Fuck off with your scams scammer") + # return + # except: + # pass try: r = requests.get('https://api.coinmarketcap.com/v1/ticker?limit=1000') j = r.json() @@ -385,16 +419,16 @@ def top(bot, trigger): price_usd = float(i['price_usd']) price_btc = float(i['price_btc']) market_cap_usd = float(i['market_cap_usd']) - if market_cap_usd >= 1000000000: - if market_cap_usd >= 100000000000: - market_cap_short = int(int(round(market_cap_usd,-9))/int(1000000000)) + if market_cap_usd >= 1e9: + if market_cap_usd >= 1e10: + market_cap_short = int(int(round(market_cap_usd,-9))/int(1e9)) else: - market_cap_short = float(int(round(market_cap_usd,-8))/int(1000000000)) + market_cap_short = float(round(market_cap_usd,-8)/1e9) rounded_mcap = str(market_cap_short)+"B" else: rounded_mcap = "tiny" topXstring += "{0}. {1} ${2} | ".format(rank, symbol, rounded_mcap) #TODO: add price_usd, rounded - bot.say(topXstring) + bot.say(topXstring[:-2]) except: bot.say("The use is 'top' and then a digit 1 - 20") @@ -545,13 +579,13 @@ def tall(bot, trigger): # 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'])) + # 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'])) # Bitflyer try: bitflyerresult = requests.get(bitflyerurl) @@ -561,7 +595,7 @@ def tall(bot, trigger): 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) + bot.say(stringtosend[:-2]) @sopel.module.commands('xmrtall', 'xmr') @@ -686,7 +720,7 @@ def xmrtall(bot, trigger): except: bot.say("Something borked ( ︶︿︶)_╭∩╮") #Finally... print to IRC - bot.say(stringtosend) + bot.say(stringtosend[:-2]) @sopel.module.commands('usd') From 6dea9da17fbd8b571d6c152048c65720944a8a1d Mon Sep 17 00:00:00 2001 From: scoobybejesus Date: Sat, 27 Jan 2018 01:17:14 -0500 Subject: [PATCH 16/33] Add binance to .xmr; try to add total mkt cap to .top --- price.py | 31 ++++++++++++++++++++++++++++--- 1 file changed, 28 insertions(+), 3 deletions(-) diff --git a/price.py b/price.py index 8246680..cb8c62e 100644 --- a/price.py +++ b/price.py @@ -385,12 +385,22 @@ def top(bot, trigger): elif limit < 1: bot.say("Dude...") else: + topXstring = "" + try: + r = requests.get('https://api.coinmarketcap.com/v1/global/') + j = r.json() + usd_total_mkt_cap = float(j[0]['total_market_cap_usd']) + total_mcap_short = int(int(round(usd_total_mkt_cap,-9))/int(1e9) + rounded_total_mcap = str(total_mcap_short)+"B" + topXstring += "Total market cap $" + rounded_total_mcap + " | " + except: + bot.say("Can't connect to coinmarketcap API") try: r = requests.get('https://api.coinmarketcap.com/v1/ticker?limit={}'.format(limit)) j = r.json() except: bot.say("Can't connect to API") - topXstring = "" + for i in j: symbol = i['symbol'] name = i['name'] @@ -630,6 +640,21 @@ def xmrtall(bot, trigger): except: bot.say("Something borked ¤\( `⌂´ )/¤") + # Binance + + try: + r = requests.get(binanceurl) + j = r.json() + found = False + for i in j: + if i["symbol"] == XMR+BTC: + last=float(i['lastPrice']) + vol=float(i['volume']) + stringtosend += ("Binance last: {0:.6f} on {1:.2f} BTC volume |".format(last, vol*last)) + found = True + except: + bot.say("Borka borka ┌∩┐(◣_◢)┌∩┐") + # Trex geturl = trexurl+'xmr' try: @@ -674,11 +699,11 @@ def xmrtall(bot, trigger): last=float(coin['last']) vol=float(coin['baseVolume']) # change=float(coin['percentChange']) - stringtosend += "Tux last: {0:.6f} BTC on {1:.2f} BTC volume.".format(last, vol) + stringtosend += "Tux last: {0:.6f} BTC on {1:.2f} BTC volume. ".format(last, vol) except: bot.say("Something borked ( ︶︿︶)_╭∩╮") #Finally... print to IRC - bot.say(stringtosend[:-2]) + bot.say(stringtosend[:-1]) @sopel.module.commands('usd') From 8da04665cac5984f5e36b1e9327d4c2dee0b3c1c Mon Sep 17 00:00:00 2001 From: root Date: Sat, 27 Jan 2018 15:22:42 +0000 Subject: [PATCH 17/33] Fixed top and xmr --- price.py | 78 ++++++++++++++++++++++++++------------------------------ 1 file changed, 36 insertions(+), 42 deletions(-) diff --git a/price.py b/price.py index cb8c62e..a003dec 100644 --- a/price.py +++ b/price.py @@ -375,51 +375,46 @@ def cmc(bot, trigger): @sopel.module.commands('top') def top(bot, trigger): - if not trigger.group(2): - bot.say("You want to see the CMC top... how many? Pick a number 1 through 20") - else: + topXstring = "" + try: try: + r = requests.get('https://api.coinmarketcap.com/v1/global/') + j = r.json() + usd_total_mkt_cap = float(j['total_market_cap_usd']) + total_mcap_short = int(int(round(usd_total_mkt_cap,-9))/int(1e9)) + rounded_total_mcap = str(total_mcap_short)+"B" + topXstring += "Total market cap $" + rounded_total_mcap + " | " + except: + bot.say("Can't connect to coinmarketcap API") + if not trigger.group(2): + limit = 20 + else: limit = int(trigger.group(2)) if limit > 20: bot.say("Too high! Max is 20!") elif limit < 1: bot.say("Dude...") + r = requests.get('https://api.coinmarketcap.com/v1/ticker?limit={}'.format(limit)) + j = r.json() + for i in j: + symbol = i['symbol'] + name = i['name'] + rank = i['rank'] + price_usd = float(i['price_usd']) + price_btc = float(i['price_btc']) + market_cap_usd = float(i['market_cap_usd']) + if market_cap_usd >= 1e9: + if market_cap_usd >= 1e10: + market_cap_short = int(int(round(market_cap_usd,-9))/int(1e9)) + else: + market_cap_short = float(round(market_cap_usd,-8)/1e9) + rounded_mcap = str(market_cap_short)+"B" else: - topXstring = "" - try: - r = requests.get('https://api.coinmarketcap.com/v1/global/') - j = r.json() - usd_total_mkt_cap = float(j[0]['total_market_cap_usd']) - total_mcap_short = int(int(round(usd_total_mkt_cap,-9))/int(1e9) - rounded_total_mcap = str(total_mcap_short)+"B" - topXstring += "Total market cap $" + rounded_total_mcap + " | " - except: - bot.say("Can't connect to coinmarketcap API") - try: - r = requests.get('https://api.coinmarketcap.com/v1/ticker?limit={}'.format(limit)) - j = r.json() - except: - bot.say("Can't connect to API") - - for i in j: - symbol = i['symbol'] - name = i['name'] - rank = i['rank'] - price_usd = float(i['price_usd']) - price_btc = float(i['price_btc']) - market_cap_usd = float(i['market_cap_usd']) - if market_cap_usd >= 1e9: - if market_cap_usd >= 1e10: - market_cap_short = int(int(round(market_cap_usd,-9))/int(1e9)) - else: - market_cap_short = float(round(market_cap_usd,-8)/1e9) - rounded_mcap = str(market_cap_short)+"B" - else: - rounded_mcap = "tiny" - topXstring += "{0}. {1} ${2} | ".format(rank, symbol, rounded_mcap) #TODO: add price_usd, rounded - bot.say(topXstring[:-2]) - except: - bot.say("The use is 'top' and then a digit 1 - 20") + rounded_mcap = "tiny" + topXstring += "{0}. {1} ${2} | ".format(rank, symbol, rounded_mcap) #TODO: add price_usd, rounded + bot.say(topXstring[:-2]) + except: + bot.say("The use is 'top' and then a digit 1 - 20") @sopel.module.commands('okc', 'okcoin') def okc(bot, trigger): @@ -640,14 +635,13 @@ def xmrtall(bot, trigger): except: bot.say("Something borked ¤\( `⌂´ )/¤") - # Binance - - try: + # Binance + try: r = requests.get(binanceurl) j = r.json() found = False for i in j: - if i["symbol"] == XMR+BTC: + if i["symbol"] == "XMRBTC": last=float(i['lastPrice']) vol=float(i['volume']) stringtosend += ("Binance last: {0:.6f} on {1:.2f} BTC volume |".format(last, vol*last)) From db6c745e63d29ca91412ccf88a1398b84527ff22 Mon Sep 17 00:00:00 2001 From: unknownids Date: Sun, 28 Jan 2018 18:25:31 -0700 Subject: [PATCH 18/33] Update trifling.py --- trifling.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/trifling.py b/trifling.py index ce586c5..006f755 100644 --- a/trifling.py +++ b/trifling.py @@ -216,6 +216,10 @@ def lambo(bot, trigger): def lenny(bot, trigger): bot.say(u'( ͡° ͜ʖ ͡°)'.encode('utf8')) +@sopel.module.commands('lietome') +def lietome(bot, trigger): + bot.say(u'https://www.youtube.com/watch?v=R5AsQbLHWbw'.encode('utf8')) + @sopel.module.commands('livermore') def livermore(bot, trigger): bot.say(u'https://en.wikipedia.org/wiki/Reminiscences_of_a_Stock_Operator'.encode('utf8')) From aa52c5ec976a322fc7cf281b9e86ad103f841867 Mon Sep 17 00:00:00 2001 From: scoobybejesus Date: Thu, 15 Feb 2018 12:30:38 -0500 Subject: [PATCH 19/33] Proper xmrtall spacing makes luigi happy --- price.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/price.py b/price.py index a003dec..bd6bd73 100644 --- a/price.py +++ b/price.py @@ -603,7 +603,7 @@ def xmrtall(bot, trigger): # Finally, price in BTC, and volume in XMR thumbBTCxmr = thumbXMRkrw/thumbBTCkrw thumbXMRVol = float(xmrjson['data']['volume_1day']) - stringtosend = "Bithumb last: {0:.6f} BTC on {1:.2f} XMR volume |".format(thumbBTCxmr,thumbXMRVol) + stringtosend = "Bithumb last: {0:.6f} BTC on {1:.2f} XMR volume | ".format(thumbBTCxmr,thumbXMRVol) except: bot.say("Error - bithumb korea is worst korea.") @@ -644,7 +644,7 @@ def xmrtall(bot, trigger): if i["symbol"] == "XMRBTC": last=float(i['lastPrice']) vol=float(i['volume']) - stringtosend += ("Binance last: {0:.6f} on {1:.2f} BTC volume |".format(last, vol*last)) + stringtosend += ("Binance last: {0:.6f} on {1:.2f} BTC volume | ".format(last, vol*last)) found = True except: bot.say("Borka borka ┌∩┐(◣_◢)┌∩┐") From 180d6e1aea34890cdcbc6e14f82c552dc71196d6 Mon Sep 17 00:00:00 2001 From: scoobybejesus Date: Thu, 15 Feb 2018 18:30:19 -0500 Subject: [PATCH 20/33] Comment out tux and cryptopia string additions from .xmrtall --- price.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/price.py b/price.py index bd6bd73..011b3c1 100644 --- a/price.py +++ b/price.py @@ -674,12 +674,12 @@ def xmrtall(bot, trigger): last=float(i['LastPrice']) # change=float(i['Change']) vol=float(i['Volume']) - stringtosend += "Cryptopia last: {0:.6f} {1} on {2:.2f} {1} volume | ".format(last, pair, vol*last) +# stringtosend += "Cryptopia last: {0:.6f} {1} on {2:.2f} {1} volume | ".format(last, pair, vol*last) found = True - if found == False: - bot.say("WTF?!?") - except: - bot.say("Something borked ( -.-)ノ-=≡≡卍") +# if found == False: +# bot.say("WTF?!?") +# except: +# bot.say("Something borked ( -.-)ノ-=≡≡卍") # Tux try: @@ -693,9 +693,9 @@ def xmrtall(bot, trigger): last=float(coin['last']) vol=float(coin['baseVolume']) # change=float(coin['percentChange']) - stringtosend += "Tux last: {0:.6f} BTC on {1:.2f} BTC volume. ".format(last, vol) - except: - bot.say("Something borked ( ︶︿︶)_╭∩╮") +# stringtosend += "Tux last: {0:.6f} BTC on {1:.2f} BTC volume. ".format(last, vol) +# except: +# bot.say("Something borked ( ︶︿︶)_╭∩╮") #Finally... print to IRC bot.say(stringtosend[:-1]) From e2721b3dadcbbc1d488a43beb29b8e4c6d6ff6d2 Mon Sep 17 00:00:00 2001 From: root Date: Sat, 21 Apr 2018 16:51:59 +0000 Subject: [PATCH 21/33] update donate --- ath.log | 1 + price.py | 172 +++++++++++++++++++++++++++++++++++++--------------- trifling.py | 6 +- 3 files changed, 127 insertions(+), 52 deletions(-) create mode 100644 ath.log diff --git a/ath.log b/ath.log new file mode 100644 index 0000000..63f6a71 --- /dev/null +++ b/ath.log @@ -0,0 +1 @@ +0.03577950 2017-08-28 492.23 2018-01-06 diff --git a/price.py b/price.py index 011b3c1..e87b9ac 100644 --- a/price.py +++ b/price.py @@ -3,6 +3,7 @@ import sopel.module import requests import time import random +import datetime # from apikey import commodity_key polourl = "https://poloniex.com/public?command=returnTicker" @@ -46,6 +47,32 @@ def forksum(bot, trigger): except: bot.say("Error parsing ticker") +@sopel.module.commands('ath') +def ath(bot, trigger): + with open('/root/.sopel/modules/ath.log', 'r') as f: + text = f.read() + btcath = float(text.split(' ')[0]) + btcathdate = text.split(' ')[1] + usdath = float(text.split(' ')[2]) + usdathdate = text.split(' ')[3] + update = False + url = 'https://api.coinmarketcap.com/v1/ticker/monero' + r = requests.get(url) + j = r.json() + price_btc = float(j[0]['price_btc']) + price_usd = float(j[0]['price_usd']) + if price_btc > btcath: + btcath = price_btc + update = True + btcathdate = datetime.datetime.fromtimestamp(int(coin['last_updated'])).strftime('%Y-%m-%d') + if price_usd > usdath: + usdath = price_usd + update = True + usdathdate = datetime.datetime.fromtimestamp(int(coin['last_updated'])).strftime('%Y-%m-%d') + if update == True: + with open('/root/.sopel/modules/ath.log', 'w') as f: + f.write("{} {} {} {}".format(btcath, btcathdate, usdath, usdathdate)) + bot.say("BTC ath = {} on {}. USD ath = ${} on {}".format(btcath, btcathdate, usdath, usdathdate)) @sopel.module.commands('bfx', 'bitfinex') def bfx(bot, trigger): @@ -335,43 +362,90 @@ def cmc(bot, trigger): # except: # pass try: - r = requests.get('https://api.coinmarketcap.com/v1/ticker?limit=1000') + r = requests.get('https://api.coinmarketcap.com/v1/ticker?limit=1500') j = r.json() except: bot.say("Can't connect to API") if not trigger.group(2): - symbol = 'XMR' + c1 = 'XMR' else: - if trigger.group(2).isdigit(): - rank = trigger.group(2) - elif trigger.group(2) == 'random': - rank = random.randint(1,1000) + if ' ' in trigger.group(2): + c1 = trigger.group(2).split(' ')[0].upper() + c2 = trigger.group(2).split(' ')[1].upper() 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,1500) + else: + c1 = trigger.group(2).upper() try: - for i in j: - 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)) + if not 'c2' in locals(): + for i in j: + try: + if i['symbol'] == c1: + 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)) + else: + for i in j: + try: + if i['symbol'] == c1: + coin = i + if i['symbol'] == c2: + c2coin = i + except: pass + symbol = coin['symbol'] + c2symbol = c2coin['symbol'] + name = coin['name'] + rank = coin['rank'] + price_usd = float(coin['price_usd']) + price_btc = float(coin['price_btc']) + c2price_btc = float(c2coin['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} {1}/{5}. 24h volume ${6:,.0f}. Market cap ${7:,.0f}. Available / total coin supply {8:,.0f} / {9:,.0f}.".format(name, symbol, rank, price_usd, price_btc/c2price_btc, c2symbol, volume_usd, market_cap_usd, available_supply, total_supply)) except: bot.say("Error parsing ticker") + try: + if c1 == 'XMR': + with open('/root/.sopel/modules/ath.log', 'r') as f: + text = f.read() + btcath = float(text.split(' ')[0]) + btcathdate = text.split(' ')[1] + usdath = float(text.split(' ')[2]) + usdathdate = text.split(' ')[3] + update = False + if price_btc > btcath: + btcath = price_btc + update = True + btcathdate = datetime.datetime.fromtimestamp(int(coin['last_updated'])).strftime('%Y-%m-%d') + if price_usd > usdath: + usdath = price_usd + update = True + usdathdate = datetime.datetime.fromtimestamp(int(coin['last_updated'])).strftime('%Y-%m-%d') + if update == True: + with open('/root/.sopel/modules/ath.log', 'w') as f: + f.write("{} {} {} {}".format(btcath, btcathdate, usdath, usdathdate)) + except: + pass @sopel.module.commands('top') def top(bot, trigger): @@ -672,32 +746,32 @@ def xmrtall(bot, trigger): for i in j["Data"]: if i["Label"] == coin+"/"+pair: last=float(i['LastPrice']) -# change=float(i['Change']) + change=float(i['Change']) vol=float(i['Volume']) -# stringtosend += "Cryptopia last: {0:.6f} {1} on {2:.2f} {1} volume | ".format(last, pair, vol*last) + stringtosend += "Cryptopia last: {0:.6f} {1} on {2:.2f} {1} volume | ".format(last, pair, vol*last) found = True -# if found == False: -# bot.say("WTF?!?") -# except: -# bot.say("Something borked ( -.-)ノ-=≡≡卍") + if found == False: + bot.say("WTF?!?") + except: + bot.say("Something borked ( -.-)ノ-=≡≡卍") # Tux - try: - r = requests.get('https://tuxexchange.com/api?method=getticker') - j = r.json() - if not trigger.group(2): - ticker='XMR' - else: - ticker=trigger.group(2).upper() - coin=j['BTC_{}'.format(ticker)] - last=float(coin['last']) - vol=float(coin['baseVolume']) -# change=float(coin['percentChange']) -# stringtosend += "Tux last: {0:.6f} BTC on {1:.2f} BTC volume. ".format(last, vol) -# except: -# bot.say("Something borked ( ︶︿︶)_╭∩╮") + # try: + # r = requests.get('https://tuxexchange.com/api?method=getticker') + # j = r.json() + # if not trigger.group(2): + # ticker='XMR' + # else: + # ticker=trigger.group(2).upper() + # coin=j['BTC_{}'.format(ticker)] + # last=float(coin['last']) + # vol=float(coin['baseVolume']) + # change=float(coin['percentChange']) + # stringtosend += "Tux last: {0:.6f} BTC on {1:.2f} BTC volume. ".format(last, vol) + # except: + # bot.say("Something borked ( ︶︿︶)_╭∩╮") #Finally... print to IRC - bot.say(stringtosend[:-1]) + bot.say(stringtosend[:-2]) @sopel.module.commands('usd') diff --git a/trifling.py b/trifling.py index 241f101..8b95560 100644 --- a/trifling.py +++ b/trifling.py @@ -114,8 +114,8 @@ def ded(bot, trigger): @sopel.module.commands('donate', 'donation') def donate(bot, trigger): - bot.say('XMR: 45SkxgDmcLmW5ByS7w9AG78JuJRvCoVKCdGJWnd4US95CBUAtvdGAdM2oHgZgTGjkEAUcwdqcryM819aqdeiKxHSQC8HkmS', trigger.nick) - bot.say('BTC: 14X8aMUtuxH2HWLtsNAxxN7j9uqQNUdMzB', trigger.nick) + bot.say('XMR: 41kroikMqj9YdcXMDt7HH7LFkhBPURMXXKtwAVu8bNA8ci9BF15tYAoQsHHotUPQuAUd9ene3sUXuJHePnZq6kcBUoQk5n8', trigger.nick) + bot.say('BTC: 1PFjRGE61szAZqM89f73CpZT54xH98tHkC', trigger.nick) @sopel.module.commands('dump') def dump(bot, trigger): @@ -229,7 +229,7 @@ def jaxx(bot, trigger): @sopel.module.commands('john_alan') def joshua(bot, trigger): - bot.say(u'I like smooth.') + bot.say(u'Ps the coverage blackspot I reported 37 times in 2016/2017 is STILL DOWN. If I were running Virigin Mobile I’d be so ashamed of myself.') @sopel.module.commands('jwinterm') def jwinterm(bot, trigger): From cf837847e7c4a818d73ca9455c3d6f36cabe2e7c Mon Sep 17 00:00:00 2001 From: LocalMonero <31570671+localmonero@users.noreply.github.com> Date: Wed, 18 Jul 2018 17:35:39 +0800 Subject: [PATCH 22/33] Add LocalMonero Average USD Price Ticker command --- price.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/price.py b/price.py index e87b9ac..230f072 100644 --- a/price.py +++ b/price.py @@ -27,6 +27,7 @@ bitflyerurl = 'https://api.bitflyer.jp/v1/ticker' thumbxmrurl = 'https://api.bithumb.com/public/ticker/xmr' # measured natively in KRW thumbbtcurl = 'https://api.bithumb.com/public/ticker/btc' # measured natively in KRW binanceurl = 'https://api.binance.com/api/v1/ticker/24hr' +localmonerousd = 'https://localmonero.co/api/ticker?currencyCode=USD' @sopel.module.commands('forksum') def forksum(bot, trigger): @@ -1066,3 +1067,16 @@ def xmy(bot, trigger): except: bot.say("Error parsing ticker") +@sopel.module.commands('localmonero', 'localxmr', 'lxmr', 'lm', 'street') +def localmonero(bot, trigger): + stringtosay = '' + try: + r = requests.get(localmonerousd) + j = r.json() + stringtosay += "LocalMonero XMR/USD 1h-avg: ${0:.2f}, 6h-avg: ${0:.2f}, 12h-avg: ${0:.2f}, 24h-avg: ${0:.2f}.".format(float(j['USD']['avg_1h']), float(j['USD']['avg_6h']), float(j['USD']['avg_12h']), float(j['USD']['avg_24h'])) + except: + bot.say("Error getting XMR/USD data") + try: + bot.say(stringtosay) + except: + bot.say("Error getting data") From 3fd33aa2f1ffcf153063f037b174bdb37f27b5b1 Mon Sep 17 00:00:00 2001 From: root Date: Sat, 28 Jul 2018 14:00:43 +0000 Subject: [PATCH 23/33] update before pull --- network.py | 4 +++- price.py | 7 +++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/network.py b/network.py index cdc1ffb..e732477 100644 --- a/network.py +++ b/network.py @@ -2,8 +2,10 @@ import sopel.module import requests import re +# networkurl = "http://node.marty.cf:18019/getinfo" # networkurl = "http://node.xmrbackb.one:18081/getinfo" -networkurl = "http://opennode.minemonero.pro:18081/getinfo" +# networkurl = "http://opennode.minemonero.pro:18081/getinfo" +networkurl = "http://node.xmr.pt:18081/getinfo" @sopel.module.commands('fork', 'forkening') def fork(bot, trigger): diff --git a/price.py b/price.py index e87b9ac..cff92c4 100644 --- a/price.py +++ b/price.py @@ -616,8 +616,11 @@ def tall(bot, trigger): finexjson = finexresult.json() except: finexjson = False - if finexjson: - stringtosend += "Bitfinex last: {0:,.2f}, vol: {1:,.1f} | ".format(float(finexjson['last_price']), float(finexjson['volume'])) + try: + if finexjson: + stringtosend += "Bitfinex last: {0:,.2f}, vol: {1:,.1f} | ".format(float(finexjson['last_price']), float(finexjson['volume'])) + except: + stringtosend += "Finex sucks | " # Bitthumb try: thumbresult = requests.get(thumbbtcurl) From c8d6553595dd60f581b1970c8de848abd63c9b4c Mon Sep 17 00:00:00 2001 From: jwinterm Date: Sat, 28 Jul 2018 07:43:56 -0700 Subject: [PATCH 24/33] Remove alt currency stuff --- price.py | 378 +++++++--------------------------------------------- trifling.py | 218 +++++++----------------------- 2 files changed, 94 insertions(+), 502 deletions(-) diff --git a/price.py b/price.py index 1c70f96..4578955 100644 --- a/price.py +++ b/price.py @@ -13,7 +13,6 @@ prevamnt, prevtime = 0, 0 trexurl = "https://bittrex.com/api/v1.1/public/getmarketsummary?market=btc-" 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' finexusd = 'https://api.bitfinex.com/v1/pubticker/XMRUSD' krakbtc = 'https://api.kraken.com/0/public/Ticker?pair=XMRXBT' @@ -44,10 +43,10 @@ def forksum(bot, trigger): if i['id'] == 'bitcoin-gold': bgoldprice = float(i['price_usd']) except: pass - bot.say("The sum of USD price of BTC, BCH, and BTG is ${:.2f}".format(btcprice+bcashprice+bgoldprice)) + bot.say("The sum of USD price of BTC, BCH, and BTG is ${:.2f}".format(btcprice+bcashprice+bgoldprice)) except: bot.say("Error parsing ticker") - + @sopel.module.commands('ath') def ath(bot, trigger): with open('/root/.sopel/modules/ath.log', 'r') as f: @@ -120,7 +119,7 @@ def krak(bot, trigger): try: bot.say(stringtosay) except: - bot.say("Error getting data") + bot.say("Error getting data") else: coin = trigger.group(2).upper() try: @@ -165,7 +164,7 @@ def chart(bot, trigger): @sopel.module.commands('polo', 'poloniex', 'marco') @sopel.module.interval(3600) def polo(bot, trigger): - if not trigger.group(2): + if not trigger.group(2): try: r=requests.get(polourl) j=r.json() @@ -173,7 +172,7 @@ def polo(bot, trigger): last=float(xmr['last']) change=float(xmr['percentChange']) vol=float(xmr['baseVolume']) - if change >= 0: + if change >= 0: sign = '+' else: sign = '' @@ -190,7 +189,7 @@ def polo(bot, trigger): face = u'\u2639'.encode('utf8') if -0.05 >= change > -0.1: face = u'\u2620'.encode('utf8') - if change < -0.1: + 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: @@ -217,7 +216,7 @@ def polo(bot, trigger): last=float(ticker['last']) change=float(ticker['percentChange']) vol=float(ticker['baseVolume']) - if change >= 0: + if change >= 0: sign = '+' else: sign = '' @@ -228,7 +227,7 @@ def polo(bot, trigger): @sopel.module.commands('lending') def lending(bot, trigger): try: - r=requests.get(poloxmrlendurl) + r=requests.get(poloxmrlendurl) j=r.json() amnt=0 currenttime=time.time() @@ -241,11 +240,11 @@ def lending(bot, trigger): prevtime=currenttime except: bot.say("Something bad happened :o") - + @sopel.module.commands('btclending') def btclending(bot, trigger): try: - r=requests.get(polobtclendurl) + r=requests.get(polobtclendurl) j=r.json() amnt=0 amnt10=0 @@ -263,13 +262,13 @@ def btclending(bot, trigger): 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): if not trigger.group(2): geturl = trexurl+'xmr' - else: + else: geturl = trexurl + trigger.group(2) try: r = requests.get(geturl) @@ -300,7 +299,7 @@ def binance(bot, trigger): if not trigger.group(2): coin = 'XMR' pair = 'BTC' - else: + else: coin = trigger.group(2).split(' ')[0].upper() try: if len(trigger.group(2).split(' ')[1]) > 1: @@ -330,7 +329,7 @@ def cryptopia(bot, trigger): if not trigger.group(2): coin = 'XMR' pair = 'BTC' - else: + else: coin = trigger.group(2).split(' ')[0].upper() try: if len(trigger.group(2).split(' ')[1]) > 1: @@ -360,7 +359,7 @@ def cmc(bot, trigger): # if trigger.group(2).lower() == 'trx': # bot.say("Fuck off with your scams scammer") # return - # except: + # except: # pass try: r = requests.get('https://api.coinmarketcap.com/v1/ticker?limit=1500') @@ -391,7 +390,7 @@ def cmc(bot, trigger): if i['rank'] == str(rank): coin = i except: pass - symbol = coin['symbol'] + symbol = coin['symbol'] name = coin['name'] rank = coin['rank'] price_usd = float(coin['price_usd']) @@ -401,7 +400,7 @@ def cmc(bot, trigger): 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)) else: for i in j: try: @@ -410,8 +409,8 @@ def cmc(bot, trigger): if i['symbol'] == c2: c2coin = i except: pass - symbol = coin['symbol'] - c2symbol = c2coin['symbol'] + symbol = coin['symbol'] + c2symbol = c2coin['symbol'] name = coin['name'] rank = coin['rank'] price_usd = float(coin['price_usd']) @@ -422,10 +421,10 @@ def cmc(bot, trigger): 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} {1}/{5}. 24h volume ${6:,.0f}. Market cap ${7:,.0f}. Available / total coin supply {8:,.0f} / {9:,.0f}.".format(name, symbol, rank, price_usd, price_btc/c2price_btc, c2symbol, volume_usd, market_cap_usd, available_supply, total_supply)) + bot.say("{0} ({1}) is #{2}. Last price ${3:.2f} / {4:.8f} {1}/{5}. 24h volume ${6:,.0f}. Market cap ${7:,.0f}. Available / total coin supply {8:,.0f} / {9:,.0f}.".format(name, symbol, rank, price_usd, price_btc/c2price_btc, c2symbol, volume_usd, market_cap_usd, available_supply, total_supply)) except: bot.say("Error parsing ticker") - try: + try: if c1 == 'XMR': with open('/root/.sopel/modules/ath.log', 'r') as f: text = f.read() @@ -472,7 +471,7 @@ def top(bot, trigger): r = requests.get('https://api.coinmarketcap.com/v1/ticker?limit={}'.format(limit)) j = r.json() for i in j: - symbol = i['symbol'] + symbol = i['symbol'] name = i['name'] rank = i['rank'] price_usd = float(i['price_usd']) @@ -487,7 +486,7 @@ def top(bot, trigger): else: rounded_mcap = "tiny" topXstring += "{0}. {1} ${2} | ".format(rank, symbol, rounded_mcap) #TODO: add price_usd, rounded - bot.say(topXstring[:-2]) + bot.say(topXstring[:-2]) except: bot.say("The use is 'top' and then a digit 1 - 20") @@ -552,57 +551,32 @@ def pepexmr(bot, trigger): @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' 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'] - usdkrw = fixerjson['rates']['KRW'] - except: - usdcny = 7 - usdkrw = 1100 - usdjpy = 112 # Bitstamp - try: + 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'])) + stringtosend += "Bitstamp last: ${0:,.2f}, vol: {1:,.1f} | ".format(float(stampjson['last']), float(stampjson['volume'])) # Gemini - try: + 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'])) + stringtosend += "Gemini last: ${0:,.2f}, vol: {1:,.1f} | ".format(float(gemijson['last']), float(gemijson['volume']['BTC'])) except: pass # Gdax - try: + try: gdaxresult = requests.get(gdaxurl) gdaxjson = gdaxresult.json() gdaxprice = float(gdaxjson['price']) @@ -610,20 +584,20 @@ def tall(bot, trigger): except: gdaxjson = False if gdaxjson: - stringtosend += "GDAX price: {0:,.2f}, vol: {1:,.1f} | ".format(gdaxprice, gdaxvolume) + stringtosend += "GDAX last: ${0:,.2f}, vol: {1:,.1f} | ".format(gdaxprice, gdaxvolume) # Bitfinex - try: + try: finexresult = requests.get(finexurl) finexjson = finexresult.json() except: finexjson = False try: if finexjson: - stringtosend += "Bitfinex last: {0:,.2f}, vol: {1:,.1f} | ".format(float(finexjson['last_price']), float(finexjson['volume'])) + stringtosend += "Bitfinex last: ${0:,.2f}, vol: {1:,.1f} | ".format(float(finexjson['last_price']), float(finexjson['volume'])) except: stringtosend += "Finex sucks | " # Bitthumb - try: + try: thumbresult = requests.get(thumbbtcurl) thumbjson = thumbresult.json() if thumbjson['data']: @@ -631,34 +605,18 @@ def tall(bot, trigger): except: thumbjson = False if thumbjson: - stringtosend += "Bithumb last: {0:,.2f}, vol: {1:,.1f} | ".format(float(thumbjson['data']['buy_price'])/float(usdkrw), float(thumbjson['data']['volume_1day'])) - # 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'])) + stringtosend += "Bithumb last: ₩{0:,.2f}, vol: {1:,.1f} | ".format(float(thumbjson['data']['buy_price']), float(thumbjson['data']['volume_1day'])) # Bitflyer - try: + 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'])) + stringtosend += "Bitflyer last: ¥{0:,.2f}, vol: {1:,.1f} | ".format(float(bitflyerjson['ltp']), float(bitflyerjson['volume_by_product'])) # Send the tickers to IRC bot.say(stringtosend[:-2]) - + @sopel.module.commands('xmrtall', 'xmr') def xmrtall(bot, trigger): @@ -684,19 +642,19 @@ def xmrtall(bot, trigger): stringtosend = "Bithumb last: {0:.6f} BTC on {1:.2f} XMR volume | ".format(thumbBTCxmr,thumbXMRVol) except: bot.say("Error - bithumb korea is worst korea.") - + # Polo try: r=requests.get(polourl) j=r.json() xmr=j["BTC_XMR"] last=float(xmr['last']) -# change=float(xmr['percentChange']) - vol=float(xmr['baseVolume']) +# change=float(xmr['percentChange']) + vol=float(xmr['baseVolume']) stringtosend += "Poloniex last: {0:.6f} BTC on {1:.2f} BTC volume | ".format(last, vol) except: - bot.say("Something borked ¯\(º_o)/¯") - + bot.say("Something borked ¯\(º_o)/¯") + # bfx try: r = requests.get(finexbtc) @@ -712,7 +670,7 @@ def xmrtall(bot, trigger): stringtosend += "Kraken last: {0:.6f} on {1:.2f} XMR volume | ".format(float(j['result']['XXMRXXBT']['c'][0]), float(j['result']['XXMRXXBT']['v'][1])) except: bot.say("Something borked ¤\( `⌂´ )/¤") - + # Binance try: r = requests.get(binanceurl) @@ -726,7 +684,7 @@ def xmrtall(bot, trigger): found = True except: bot.say("Borka borka ┌∩┐(◣_◢)┌∩┐") - + # Trex geturl = trexurl+'xmr' try: @@ -739,7 +697,7 @@ def xmrtall(bot, trigger): stringtosend += "Bittrex last: {0:.6f} BTC on {1:.2f} BTC volume | ".format(last, vol) except: bot.say("Something borked -_-") - + # Cryptopia try: coin = 'XMR' @@ -758,7 +716,7 @@ def xmrtall(bot, trigger): bot.say("WTF?!?") except: bot.say("Something borked ( -.-)ノ-=≡≡卍") - + # Tux # try: # r = requests.get('https://tuxexchange.com/api?method=getticker') @@ -788,224 +746,6 @@ def usd(bot, trigger): 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('inr') -def inr(bot, trigger): - # Get conversion rate - try: - fixerresult = requests.get(fixerurl) - fixerjson = fixerresult.json() - usdthb = fixerjson['rates']['INR'] - except: - usdthb = 64 - 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 INR = ₹{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") @sopel.module.commands('price') def price(bot, trigger): @@ -1014,30 +754,6 @@ def price(bot, trigger): 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_EIB' - 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...") - @sopel.module.commands('xmy') def xmy(bot, trigger): try: @@ -1056,7 +772,7 @@ def xmy(bot, trigger): if i['rank'] == str(rank): coin = i except: pass - symbol = coin['symbol'] + symbol = coin['symbol'] name = coin['name'] rank = coin['rank'] price_usd = float(coin['price_usd']) @@ -1066,7 +782,7 @@ def xmy(bot, trigger): 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: bot.say("Error parsing ticker") diff --git a/trifling.py b/trifling.py index 8b95560..6539051 100644 --- a/trifling.py +++ b/trifling.py @@ -53,11 +53,11 @@ def brothers(bot, trigger): def buyorsell(bot, trigger): draw = random.random() if draw < 0.33: - silly_string = "Sell, sell, sell!" + silly_string = "Sell, sell, sell!" elif 0.66 > draw >= 0.33: - silly_string = "Hodl!" + silly_string = "Hodl!" elif 1 > draw >= 0.66: - silly_string = "Buy, buy, buy!" + silly_string = "Buy, buy, buy!" bot.say(silly_string) @sopel.module.commands('cheerup') @@ -76,14 +76,14 @@ def cryptosid(bot, trigger): 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'] + 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) + bot.say(outstring) @sopel.module.commands('dash') def dash(bot, trigger): @@ -92,7 +92,7 @@ def dash(bot, trigger): @sopel.module.commands('dealwithit') def dealwithit(bot, trigger): bot.say(u'(•_•) ( •_•)>⌐■-■ (⌐■_■)'.encode('utf8')) - + @sopel.module.commands('Deathtobitcoin', 'Deathtobitcoin2') def deathtobitcoin2(bot, trigger): bot.say('Devs, moderators, whoever you fucking are, please put my money back with interest. Or make my money appear in my wallet with interest!') @@ -161,7 +161,7 @@ def gui(bot, trigger): hitleroptions = [ 'https://www.youtube.com/watch?v=L2WfedZG7bo', -r"There's always Aeon", +r"There's always Aeon", 'http://adolfcoin.camp/' ] @sopel.module.commands('hitler', 'adolf') @@ -200,7 +200,7 @@ def hotline(bot, trigger): @sopel.module.commands('news') def news(bot, trigger): bot.say("https://www.youtube.com/watch?v=Gr_WtFW0a8Y") - + @sopel.module.commands('invest') def invest(bot, trigger): bot.say('i think invest in bitcoin is much more safe and profitable because bitcoin price rising to higher value and we do not face to any risk when we invest our money in bitcoin and i if we invest our money in bitcoin we will be get a good profit from bitcoin in the future so i think bitcoin is much more profitable currency than altcoins.') @@ -209,11 +209,11 @@ def invest(bot, trigger): def isittrue(bot, trigger): draw = random.random() if draw < 0.33: - silly_string = "True as the day is long." + silly_string = "True as the day is long." elif 0.66 > draw >= 0.33: - silly_string = "Irrelevant question in this post-truth world." + silly_string = "Irrelevant question in this post-truth world." elif 1 > draw >= 0.66: - silly_string = "Lies! Damn Lies! It's statitistics!" + silly_string = "Lies! Damn Lies! It's statitistics!" bot.say(silly_string) @sopel.module.commands('jaxx') @@ -238,11 +238,11 @@ def jwinterm(bot, trigger): @sopel.module.commands('kid', 'rehrar') def kid(bot, trigger): bot.say(u'What up kid?') - + @sopel.module.commands('koan') def koan(bot, trigger): bot.say("The use cases are many and varied") - + @sopel.module.commands('kramer') def kramer(bot, trigger): bot.say("Waiting for a retrace to 0.007") @@ -257,8 +257,8 @@ def lenny(bot, trigger): @sopel.module.commands('lietome') def lietome(bot, trigger): - bot.say(u'https://www.youtube.com/watch?v=R5AsQbLHWbw'.encode('utf8')) - + bot.say(u'https://www.youtube.com/watch?v=R5AsQbLHWbw'.encode('utf8')) + @sopel.module.commands('livermore') def livermore(bot, trigger): bot.say(u'https://en.wikipedia.org/wiki/Reminiscences_of_a_Stock_Operator'.encode('utf8')) @@ -323,7 +323,7 @@ def orff(bot, trigger): @sopel.module.commands('pamp') def pamp(bot, trigger): bot.say("Pamp o clock yet?") - + perooptions = [ 'https://www.youtube.com/watch?v=QqreRufrkxM', 'https://www.youtube.com/watch?v=ZnPrtiLy0uU', @@ -336,19 +336,19 @@ def pero(bot, trigger): @sopel.module.commands('pivx') def pivc(bot, trigger): bot.say("Masternodes + PoS...what could possibly go wrong?") - + @sopel.module.commands('pony') def pony(bot, trigger): bot.say("https://www.youtube.com/watch?v=O3rpmctmC_M") - + @sopel.module.commands('primer') def primer(bot, trigger): bot.say("The point is not how much i made, point is fluffy did this on purpose, more than 10 people were in on it. His commit access needs to be revoked asap!") - + @sopel.module.commands('pubg') def pubg(bot, trigger): bot.say("https://i.redd.it/o6o5gqmetacz.jpg") - + confirmoptions = [ "I can confirm that it is true", "This is true", @@ -387,7 +387,7 @@ def rarepepe(bot, trigger): 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): @@ -401,13 +401,13 @@ def risto(bot, trigger): def romerito(bot, trigger): draw = random.random() if draw < 0.25: - silly_string = "O Romerito, Romerito! wherefore art thou Romerito?" + 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" + 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" + 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!" + silly_string = "Et tu, Romerito!" bot.say(silly_string) @sopel.module.commands('scam') @@ -497,22 +497,22 @@ def unflip(bot, trigger): bot.say(u'┬─┬ノ( º _ ºノ)'.encode('utf8')) urmomoptions = [ -"ur mom is so stupid she bought all the dash", +"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 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 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)) @@ -520,7 +520,7 @@ def urmom(bot, trigger): @sopel.module.commands('verge', 'xvg', 'wraith') def verge(bot, trigger): bot.say(u"👻🐕 Don't wraith my dark doge bro! 👻🐕".encode('utf8')) - + vitalikoptions = [ "https://pbs.twimg.com/media/CrWjczJXgAExF2S.jpg", "mETH, not even once: https://cdn-az.allevents.in/banners/e7df519e0808bac49fa3aaf503aff87d", @@ -534,17 +534,21 @@ def vitalik(bot, trigger): @sopel.module.commands('wat') def wat(bot, trigger): bot.say("https://www.destroyallsoftware.com/talks/wat") - + +@sopel.module.commands('wow') +def wow(bot, trigger): + bot.say("Let he who is without win cast the first 💎: http://wownero.org") + @sopel.module.commands('yoda') def yoda(bot, trigger): bot.say("The optimism is strong in this one") - + @sopel.module.commands('xrp') def xrp(bot, trigger): bot.say("We have the best C++ dev team in the world!") zcashoptions = [ -"Trust us guys, we totally smashed that computer up, with like...magnetic baseball bats.", +"Trust us guys, we totally smashed that computer up, with like...magnetic baseball bats.", "https://youtu.be/A51Bl3jkF0c" ] @sopel.module.commands('zec', 'zcash') @@ -566,134 +570,6 @@ def wave(bot, trigger): @sopel.module.rule('.*1Dj34exPs3S9qAV1aiGAAADzbashsSVKVP*.') def scamdouble(bot, trigger): bot.say("{} is a scammer and bitcoin is a scam".format(trigger.nick)) - -@sopel.module.commands('asp') -def asp(bot, trigger): - polourl = "https://poloniex.com/public?command=returnTicker" - stampurl = 'https://www.bitstamp.net/api/ticker/' - cmcurl = "https://api.coinmarketcap.com/v1/ticker/monero/" - trexurl = "https://bittrex.com/api/v1.1/public/getmarketsummary?market=btc-ans" - - try: - r=requests.get(cmcurl) - j=r.json() - xmrbtc_price=float(j[0]['price_btc']) - except: - bot.say("Error connecting to CoinMarketCap") - try: - r = requests.get(trexurl) - j = r.json() - ans=j['result'][0] - last=float(ans['Last']) - value_ans = float(last*231.6) - except: - print ("Error retrieving data from Bittrex") - try: - r=requests.get(polourl) - j=r.json() - except: - bot.say("Error connecting to Poloniex") - - label_dash="BTC_DASH" - label_decred="BTC_DCR" - label_factom="BTC_FCT" - label_golem="BTC_GNT" - label_maidsafecoin="BTC_MAID" - label_augur="BTC_REP" - label_stellar="BTC_STR" - label_nem="BTC_XEM" - label_ripple="BTC_XRP" - label_zcash="BTC_ZEC" - label_nxt="BTC_NXT" - label_sia="BTC_SC" - label_dgb="BTC_DGB" - label_sys="BTC_SYS" - - # Bitstamp - try: - stampresult = requests.get(stampurl) - stampjson = stampresult.json() - except: - stampjson = False - if stampjson: - stamp_price = float(stampjson['last']) - # Poloniex - try: - ticker_dash=j[label_dash] - ticker_decred=j[label_decred] - ticker_factom=j[label_factom] - ticker_golem=j[label_golem] - ticker_maidsafecoin=j[label_maidsafecoin] - ticker_augur=j[label_augur] - ticker_stellar=j[label_stellar] - ticker_nem=j[label_nem] - ticker_ripple=j[label_ripple] - ticker_zcash=j[label_zcash] - ticker_nxt=j[label_nxt] - ticker_sia=j[label_sia] - ticker_dgb=j[label_dgb] - ticker_sys=j[label_sys] - last_dash=float(ticker_dash['last']) - last_decred=float(ticker_decred['last']) - last_factom=float(ticker_factom['last']) - last_golem=float(ticker_golem['last']) - last_maidsafecoin=float(ticker_maidsafecoin['last']) - last_augur=float(ticker_augur['last']) - last_stellar=float(ticker_stellar['last']) - last_nem=float(ticker_nem['last']) - last_ripple=float(ticker_ripple['last']) - last_zcash=float(ticker_zcash['last']) - last_nxt=float(ticker_nxt['last']) - last_sia=float(ticker_sia['last']) - last_dgb=float(ticker_dgb['last']) - last_sys=float(ticker_sys['last']) - value_dash = float(last_dash*18.84760476) - value_decred = float(last_decred*93.74095377) - value_factom = float(last_factom*207.78912373) - value_golem = float(last_golem*7374.44608569) - value_maidsafecoin = float(last_maidsafecoin*5973.05389222) - value_augur = float(last_augur*94.01892768) - value_stellar = float(last_stellar*318974.81202454) - value_stellar_h = float(8.34800202) - value_nem = float(last_nem*29892.11866946) - value_ripple = float(last_ripple*27962.37965895) - value_ripple_h = float(3.17485452) - value_zcash = float(last_zcash*16.47649534) - value_nxt = float(last_nxt*14932.63473053) - value_sia = float(last_sia*129377.43190662) - value_dgb = float(last_dgb*84177.21518989) - value_sys = float(last_sys*10523.26194748) - - total = value_dash + value_decred + value_factom + value_golem + value_maidsafecoin + value_augur + value_stellar + value_nem + value_ripple + value_zcash - total_h = value_dash + value_decred + value_factom + value_golem + value_maidsafecoin + value_augur + value_stellar_h + value_nem + value_ripple_h + value_zcash - total_june = value_nxt + value_sia + value_dgb + value_sys + value_ans - xmr_totalvalue = float(total / xmrbtc_price) - asppercent = ((((stamp_price * total) / 14950)-1)*100) + ((((stamp_price * total_june) / 13240)-1)*100) - if asppercent >= 0: - aspsign = '+' - else: - aspsign = '-' - xmrpercent = ((((650*(xmrbtc_price*stamp_price)/14950)-1)*100)) + (((250*(xmrbtc_price*stamp_price)/13240)-1)*100) - if xmrpercent >= 0: - xmrsign = '+' - else: - xmrsign = '-' - asppercent_h = ((((stamp_price * total_h) / 14950)-1)*100) + ((((stamp_price * total_june) / 13240)-1)*100) - if asppercent_h >= 0: - aspsign_h = '+' - else: - aspsign_h = '-' - bot.say("{0} {1:.2f}BTC; {2} {3:.2f}BTC; {4} {5:.2f}BTC; {6} {7:.2f}BTC; {8} {9:.2f}BTC; {10} {11:.2f}BTC; {12} {13:.2f}[{14:.2f}]BTC; {15} {16:.2f}BTC; {17} {18:.2f}[{19:.2f}]BTC; {20} {21:.2f}BTC; {22} {23:.2f}BTC; {24} {25:.2f}BTC; {26} {27:.2f}BTC; {28} {29:.2f}BTC; {30} {31:.2f}BTC; ASP Total:{32:.2f}[{33:.2f}]BTC/{34:,.0f}USD/{35:,.1f}XMR (02-May+20-Jun outlay, 10BTC+5BTC/14,950USD+13,240USD/650XMR+250XMR) (Since begin ASP:{36}{37:.2f}[{38}{39:.2f}]% XMR:{40}{41:.2f}%, Harvested 11.52BTC)".format("DASH", value_dash, "DCR", value_decred, "FCT", value_factom, "GNT", value_golem, "MAID", value_maidsafecoin, "REP", value_augur, "STR", value_stellar, value_stellar_h, "XEM", value_nem, "XRP", value_ripple, value_ripple_h, "ZEC", value_zcash, "NXT", value_nxt, "SIA", value_sia, "DGB", value_dgb, "SYS", value_sys, "ANS", value_ans, total+total_june, total_h+total_june, stamp_price * (total + total_june), xmr_totalvalue, aspsign, asppercent, aspsign_h, asppercent_h, xmrsign, xmrpercent)) - except: - bot.say("ERROR!") - -@sopel.module.commands('wtfisasp') -def wtfisasp(bot, trigger): - bot.say("ASP means the Angry Shitcoin Portfolio, a list of the top 15 coins that piss me off as people mindlessly pour money into them.") - -@sopel.module.commands('asprules') -def asprules(bot, trigger): - bot.say("1. Shitcoins only, eg. a premine, ICO, Corporate, APPCoin, Buzzwordy, Copycat, etc. . 2. Must have high volume, it needs staying power to be considered as the ASP is a longterm thing. 3. 1 BTC gets bought of each coin on the list, as this list is not fictional, laughable as that is. 4. No trading, buy and hold only. 5. Can be liquidated at my discretion, but preferably once it's fleeced users of 4> BTC in value or more, or almost nothing is left (<0.1 BTC in value). 5. Each shitcoin should preferably should have a poor/toxic community, and or dev group shilling, censoring, etc. . 6. I must literally hate the idea of this coins existence.") @sopel.module.commands('whaleornot') def whaleornot(bot, trigger): @@ -704,13 +580,13 @@ def whaleornot(bot, trigger): try: xmr_size = float(trigger.group(2)) if xmr_size <= 0: - fish_string = "amoeba" + fish_string = "amoeba" elif xmr_size < 0.1: - fish_string = "plankton" + fish_string = "plankton" elif xmr_size >= 0.1 and xmr_size < 0.2: - fish_string = "Paedocypris" + fish_string = "Paedocypris" elif xmr_size >= 0.2 and xmr_size < 0.5: - fish_string = "Dwarf Goby" + fish_string = "Dwarf Goby" elif xmr_size >= 0.5 and xmr_size < 1: fish_string = "European Pilchard" elif xmr_size >= 1 and xmr_size < 2: @@ -754,5 +630,5 @@ def whaleornot(bot, trigger): bot.say("Try a base ten representation of a number") @sopel.module.commands('trebuchet') -def trebuchet(bot, trigger): +def trebuchet(bot, trigger): bot.say("Can YOU use a counterweight to launch a 90 kg projectile over 300 meters? Yeah, I thought not.") From ebb5d9121363a8c0ab87cffb9767cb2a1f96e95d Mon Sep 17 00:00:00 2001 From: root Date: Sat, 28 Jul 2018 14:50:05 +0000 Subject: [PATCH 25/33] Fix local monero --- price.py | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/price.py b/price.py index 4578955..ab0813e 100644 --- a/price.py +++ b/price.py @@ -788,14 +788,10 @@ def xmy(bot, trigger): @sopel.module.commands('localmonero', 'localxmr', 'lxmr', 'lm', 'street') def localmonero(bot, trigger): - stringtosay = '' try: r = requests.get(localmonerousd) j = r.json() - stringtosay += "LocalMonero XMR/USD 1h-avg: ${0:.2f}, 6h-avg: ${0:.2f}, 12h-avg: ${0:.2f}, 24h-avg: ${0:.2f}.".format(float(j['USD']['avg_1h']), float(j['USD']['avg_6h']), float(j['USD']['avg_12h']), float(j['USD']['avg_24h'])) - except: - bot.say("Error getting XMR/USD data") - try: + stringtosay = "LocalMonero XMR/USD 12h-avg: ${0:.2f}, 24h-avg: ${0:.2f}.".format(float(j['USD']['avg_12h']), float(j['USD']['avg_24h'])) bot.say(stringtosay) except: bot.say("Error getting data") From e8ed5316cb20be5a51b6f1c58108739ce2a23f27 Mon Sep 17 00:00:00 2001 From: jwinterm Date: Sat, 28 Jul 2018 12:56:30 -0700 Subject: [PATCH 26/33] add ogre --- price.py | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/price.py b/price.py index ab0813e..484fc67 100644 --- a/price.py +++ b/price.py @@ -27,6 +27,7 @@ thumbxmrurl = 'https://api.bithumb.com/public/ticker/xmr' # measured natively in thumbbtcurl = 'https://api.bithumb.com/public/ticker/btc' # measured natively in KRW binanceurl = 'https://api.binance.com/api/v1/ticker/24hr' localmonerousd = 'https://localmonero.co/api/ticker?currencyCode=USD' +ogreurl = 'https://tradeogre.com/api/v1/markets' @sopel.module.commands('forksum') def forksum(bot, trigger): @@ -281,6 +282,23 @@ def trex(bot, trigger): except: bot.say("Error retrieving data from Bittrex") +@sopel.module.commands('tradeogre', 'ogre') +def ogre(bot, trigger): + if not trigger.group(2): + coin = 'XMR' + else: + coin = trigger.group(2).upper() + try: + r = requests.get(ogreurl) + j = r.json() + for i in j: + if "BTC-"+coin == i.key(): + last=float(i['price']) + vol=float(i['volume']) + bot.say("Tradeogre at {0:.8f} BTC; on {1:.3f} BTC volume".format(last, vol)) + except: + bot.say("Error retrieving data from Ogre") + @sopel.module.commands('bsq', 'bitsquare') def bsq(bot, trigger): try: @@ -754,6 +772,12 @@ def price(bot, trigger): except: bot.say("C-cex sucks") +@sopel.module.commands('comm') +def comm(bot, trigger): + pass + + + @sopel.module.commands('xmy') def xmy(bot, trigger): try: From ab05ba5b607487133524da9756c802d36e5e3d01 Mon Sep 17 00:00:00 2001 From: jwinterm Date: Sat, 28 Jul 2018 13:08:20 -0700 Subject: [PATCH 27/33] fix ogre --- price.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/price.py b/price.py index 484fc67..e9dc42c 100644 --- a/price.py +++ b/price.py @@ -285,16 +285,16 @@ def trex(bot, trigger): @sopel.module.commands('tradeogre', 'ogre') def ogre(bot, trigger): if not trigger.group(2): - coin = 'XMR' + pair = 'BTC-XMR' else: - coin = trigger.group(2).upper() + coin = 'BTC-'+trigger.group(2).upper() try: r = requests.get(ogreurl) j = r.json() for i in j: - if "BTC-"+coin == i.key(): - last=float(i['price']) - vol=float(i['volume']) + if pair == i.keys(): + last=float(i[pair]['price']) + vol=float(i[pair]['volume']) bot.say("Tradeogre at {0:.8f} BTC; on {1:.3f} BTC volume".format(last, vol)) except: bot.say("Error retrieving data from Ogre") From 7e9c2f911753de43ca0e9dad2f691a5ae6b736d4 Mon Sep 17 00:00:00 2001 From: root Date: Sat, 28 Jul 2018 20:14:37 +0000 Subject: [PATCH 28/33] Fix ogre 2 --- price.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/price.py b/price.py index e9dc42c..a6da320 100644 --- a/price.py +++ b/price.py @@ -285,17 +285,17 @@ def trex(bot, trigger): @sopel.module.commands('tradeogre', 'ogre') def ogre(bot, trigger): if not trigger.group(2): - pair = 'BTC-XMR' + pair = 'BTC-XMR' else: - coin = 'BTC-'+trigger.group(2).upper() + pair = 'BTC-'+trigger.group(2).upper() try: r = requests.get(ogreurl) j = r.json() for i in j: - if pair == i.keys(): + if pair == i.keys()[0]: last=float(i[pair]['price']) vol=float(i[pair]['volume']) - bot.say("Tradeogre at {0:.8f} BTC; on {1:.3f} BTC volume".format(last, vol)) + bot.say("{0} on Tradeogre at {1:.8f} BTC on {2:.3f} BTC volume".format(pair, last, vol)) except: bot.say("Error retrieving data from Ogre") From 3701359cf6730816eb21d319ed83e9812ac5bfd6 Mon Sep 17 00:00:00 2001 From: jwinterm Date: Sat, 28 Jul 2018 13:43:44 -0700 Subject: [PATCH 29/33] add commodity --- price.py | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/price.py b/price.py index a6da320..b78f720 100644 --- a/price.py +++ b/price.py @@ -774,9 +774,24 @@ def price(bot, trigger): @sopel.module.commands('comm') def comm(bot, trigger): - pass - - + commurl = 'https://api.commoprices.com/v1/wrb/' + apitoken = '?api_token=9gdRSeoek4N0AnZHUvP0TSIR74jmyQpsjz5HuGRjfDmsCDxppYiG76GuxaF1' + try: + r = requests.get(commurl+apitoken) + data = r.json()['data'] + for i in data: + if trigger.group(2).lower() in i['name'].lower(): + print(i) + code = i['code'] + except: + bot.say("Error getting data or commodity not priced") + break + try: + r2 = requests.get(commurl+code+'/data/'+apitoken) + j = r2.json() + bot.say("{0} last price at {1:.2f} {2} on {3}".format(j['data']['info']['name'], j['data']['request']['dataseries'][-1][1], j['data']['info']['original_price_unit']['name'], j['data']['request']['dataseries'][-1][0])) + except: + bot.say("Error parsing some shit") @sopel.module.commands('xmy') def xmy(bot, trigger): From 582909cd83c8b0ad27877ac6b1ce3a72746cdeaa Mon Sep 17 00:00:00 2001 From: scoobybejesus Date: Thu, 18 Oct 2018 11:23:46 -0400 Subject: [PATCH 30/33] v9 fork height --- network.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/network.py b/network.py index e732477..b855b25 100644 --- a/network.py +++ b/network.py @@ -16,7 +16,7 @@ def fork(bot, trigger): pass try: height=j["height"] - forkheight=1400000 + forkheight=1686275 if forkheight > height: 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)) else: From 9001491e6be60e20f179451e6fded5074ca277e4 Mon Sep 17 00:00:00 2001 From: root Date: Thu, 18 Oct 2018 23:49:23 +0000 Subject: [PATCH 31/33] update before merge --- network.py | 2 +- price.py | 16 ++++++++++++++-- trifling.py | 32 ++++++++++++++++++++++++++------ 3 files changed, 41 insertions(+), 9 deletions(-) diff --git a/network.py b/network.py index e732477..de1d63b 100644 --- a/network.py +++ b/network.py @@ -16,7 +16,7 @@ def fork(bot, trigger): pass try: height=j["height"] - forkheight=1400000 + forkheight=1685555 if forkheight > height: 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)) else: diff --git a/price.py b/price.py index b78f720..9cb6f27 100644 --- a/price.py +++ b/price.py @@ -602,7 +602,19 @@ def tall(bot, trigger): except: gdaxjson = False if gdaxjson: - stringtosend += "GDAX last: ${0:,.2f}, vol: {1:,.1f} | ".format(gdaxprice, gdaxvolume) + stringtosend += "CBP last: ${0:,.2f}, vol: {1:,.1f} | ".format(gdaxprice, gdaxvolume) + # Binance + try: + binanceresult = requests.get(binanceurl) + binancejson = binanceresult.json() + for i in binancejson: + if i["symbol"] == "BTCUSDT": + binanceprice = float(i['lastPrice']) + binancevolume = float(i['volume']) + except: + binancejson = False + if binancejson: + stringtosend += "Binance last: ${0:,.2f}, vol: {1:,.1f} | ".format(binanceprice, binancevolume) # Bitfinex try: finexresult = requests.get(finexurl) @@ -785,7 +797,7 @@ def comm(bot, trigger): code = i['code'] except: bot.say("Error getting data or commodity not priced") - break + return try: r2 = requests.get(commurl+code+'/data/'+apitoken) j = r2.json() diff --git a/trifling.py b/trifling.py index 6539051..9c7d2ae 100644 --- a/trifling.py +++ b/trifling.py @@ -11,11 +11,15 @@ from threading import Timer def fourmatter(bot, trigger): bot.say('Irish I be fookin <3 Milo') -@sopel.module.commands('allah') -def allah(bot, trigger): - bot.say('allah is doing') - bot.say('sun is not doing allah is doing') - bot.say('to accept Islam say that i bear witness that there is no deity worthy of worship except Allah and Muhammad peace be upon him is his slave and messenger') +# @sopel.module.commands('allah') +# def allah(bot, trigger): +# bot.say('allah is doing') +# bot.say('sun is not doing allah is doing') +# bot.say('to accept Islam say that i bear witness that there is no deity worthy of worship except Allah and Muhammad peace be upon him is his slave and messenger') + +@sopel.module.commands('ada', 'hoskinson') +def ada(bot, trigger): + bot.say('DO YOU KNOW WHO I AM?') @sopel.module.commands('aminorex') def aminorex(bot, trigger): @@ -49,6 +53,10 @@ def bear(bot, trigger): def brothers(bot, trigger): bot.say(u'http://www.trollaxor.com/2011/11/brief-history-of-ascii-penis.html'.encode('utf8')) +@sopel.module.commands('bp', 'bps', 'bulletproof', 'bulletproofs') +def bulletproofs(bot, trigger): + bot.say(u'https://www.youtube.com/watch?v=Kk8eJh4i8Lo'.encode('utf8')) + @sopel.module.commands('buyorsell') def buyorsell(bot, trigger): draw = random.random() @@ -279,6 +287,10 @@ def major(bot, trigger): def masternode(bot, trigger): bot.say('http://hadoopilluminated.com/hadoop_illuminated/images/hdfs3.jpg') +@sopel.module.commands('monerov', 'v') +def monerov(bot, trigger): + bot.say(u"🔒🔒🔒 MoneroV is more secured than others. That's why it is better invest on moneroV. 💰💰💰".encode('utf8')) + @sopel.module.commands('moon') def moon(bot, trigger): bot.say(u'┗(°0°)┛'.encode('utf8')) @@ -297,7 +309,7 @@ def needmoney(bot, trigger): @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')) + bot.say(u'https://ifunny.co/fun/laeIohx56'.encode('utf8')) @sopel.module.commands('nomnomnom') def nomnomnom(bot, trigger): @@ -307,6 +319,10 @@ def nomnomnom(bot, trigger): def noom(bot, trigger): bot.say(u'┏(.0.)┓'.encode('utf8')) +@sopel.module.commands('notbad', 'dorian') +def notbad(bot, trigger): + bot.say(u'(´ー`) http://hackingdistributed.com/images/2014-01-01-bitcoin/dorian1.jpg (´ー`)'.encode('utf8')) + odboptions = [ "FBI don't you be watching me", "Ooo baby I like it raw", @@ -345,6 +361,10 @@ def pony(bot, trigger): def primer(bot, trigger): bot.say("The point is not how much i made, point is fluffy did this on purpose, more than 10 people were in on it. His commit access needs to be revoked asap!") +@sopel.module.commands('praise') +def praise(bot, trigger): + bot.say("https://praisemonero.com") + @sopel.module.commands('pubg') def pubg(bot, trigger): bot.say("https://i.redd.it/o6o5gqmetacz.jpg") From 25c19a2da96feec6d20897bb62d60d93dae5f6f5 Mon Sep 17 00:00:00 2001 From: xmaus <37954179+xmaus@users.noreply.github.com> Date: Sun, 25 Nov 2018 22:08:27 +0100 Subject: [PATCH 32/33] Update trifling.py Baka baka baka song line 656-658 --- trifling.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/trifling.py b/trifling.py index 9c7d2ae..7d6af61 100644 --- a/trifling.py +++ b/trifling.py @@ -652,3 +652,9 @@ def whaleornot(bot, trigger): @sopel.module.commands('trebuchet') def trebuchet(bot, trigger): bot.say("Can YOU use a counterweight to launch a 90 kg projectile over 300 meters? Yeah, I thought not.") + +@sopel.module.commands('baka') +def baka(bot, trigger): + bot.say(u'https://www.youtube.com/watch?v=n5n7CSGPzqw'.encode(utf8)) + + From e42feab0524f762e5bb3fb1bda76e02e46e398c9 Mon Sep 17 00:00:00 2001 From: root Date: Tue, 27 Nov 2018 01:16:19 +0000 Subject: [PATCH 33/33] Check up to date --- price.py | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/price.py b/price.py index 9cb6f27..50e1ce3 100644 --- a/price.py +++ b/price.py @@ -29,6 +29,24 @@ binanceurl = 'https://api.binance.com/api/v1/ticker/24hr' localmonerousd = 'https://localmonero.co/api/ticker?currencyCode=USD' ogreurl = 'https://tradeogre.com/api/v1/markets' +@sopel.module.commands('stock') +def stock(bot, trigger): + if trigger.group(2): + ticker = trigger.group(2).upper() + else: ticker = 'WOW' + try: + r = requests.get('https://api.iextrading.com/1.0/stock/{}/batch?types=quote,news,chart&range=1m&last=10'.format(ticker)) + j = r.json() + name = j['quote']['companyName'] + exchange = j['quote']['primaryExchange'] + date = j['quote']['latestTime'] + high = j['quote']['high'] + low = j['quote']['low'] + last = j['quote']['latestPrice'] + bot.say("{} ({}) trading at {} on {} had a high of {:.2f}, a low of {:.2f}, and last price of {:.2f}".format(name, ticker, exchange, date, high, low, last)) + except: + bot.say("Can't find {}".format(ticker)) + @sopel.module.commands('forksum') def forksum(bot, trigger): url = 'https://api.coinmarketcap.com/v1/ticker/?bch' @@ -95,6 +113,26 @@ def bfx(bot, trigger): except: bot.say("Error getting data") +@sopel.module.commands('gecko', 'cg', 'gec') +def gecko(bot, trigger): + if not trigger.group(2): + coin = "monero" + else: + coin = trigger.group(2) + try: + r = requests.get('https://api.coingecko.com/api/v3/coins/'+coin) + j = r.json() + coinid = j['id'] + mcaprank = j['market_cap_rank'] + geckorank = j['coingecko_rank'] + btcprice = j['market_data']['current_price']['btc'] + usdprice = j['market_data']['current_price']['usd'] + athbtc = j['market_data']['ath']['btc'] + athusd = j['market_data']['ath']['usd'] + bot.say("{} ({}) is #{:.0f} by mcap and #{:.0f} by coingecko rank. Current price is {:.8f} BTC / ${:.3f}. ATH price is {:.8f} BTC / ${:.3f}.".format(coin, coinid, mcaprank, geckorank, btcprice, usdprice, athbtc, athusd)) + except: + bot.say("Couldn't find {} on le gecko".format(coin)) + @sopel.module.commands('krak', 'kraken') def krak(bot, trigger): stringtosay = ''