fix ye
This commit is contained in:
parent
7db20d993d
commit
77fcdad55d
24
network.py
24
network.py
|
@ -95,3 +95,27 @@ def solo(bot, trigger):
|
||||||
@sopel.module.commands('b2x')
|
@sopel.module.commands('b2x')
|
||||||
def b2x(bot, trigger):
|
def b2x(bot, trigger):
|
||||||
bot.say("Fuck off \\x")
|
bot.say("Fuck off \\x")
|
||||||
|
|
||||||
|
def get_pools(coin = 'monero'):
|
||||||
|
resp = requests.get("https://data.miningpoolstats.stream/data/time")
|
||||||
|
time = int(resp.text)
|
||||||
|
resp = requests.get("https://data.miningpoolstats.stream/data/{}.js?t={}".format(coin, time))
|
||||||
|
j = resp.json()
|
||||||
|
return j
|
||||||
|
@sopel.module.commands('miners')
|
||||||
|
def print_monero_miners_counter(bot, trigger):
|
||||||
|
pools = get_pools()
|
||||||
|
result = {
|
||||||
|
'website counter': pools['poolsminers'],
|
||||||
|
'website counter recalculated': sum([
|
||||||
|
e['miners'] if ('miners' in e and isinstance(e['miners'], int) and e['miners'] >= 0) else (
|
||||||
|
e['workers'] if ('workers' in e and isinstance(e['workers'], int) and e['workers'] >= 0) else (
|
||||||
|
0
|
||||||
|
)
|
||||||
|
)
|
||||||
|
for e in pools['data']
|
||||||
|
]),
|
||||||
|
'count(miners) where miners >= 0': sum([e['miners'] for e in pools['data'] if 'miners' in e and isinstance(e['miners'], int) and e['miners'] > 0]),
|
||||||
|
'count(workers) where workers >= 0': sum([e['workers'] for e in pools['data'] if 'workers' in e and isinstance(e['workers'], int) and e['workers'] > 0]),
|
||||||
|
}
|
||||||
|
bot.say(result)
|
||||||
|
|
74
price.py
74
price.py
|
@ -6,6 +6,7 @@ import random
|
||||||
import datetime
|
import datetime
|
||||||
import re
|
import re
|
||||||
import client
|
import client
|
||||||
|
import csv
|
||||||
|
|
||||||
polourl = "https://poloniex.com/public?command=returnTicker"
|
polourl = "https://poloniex.com/public?command=returnTicker"
|
||||||
poloxmrlendurl = "https://poloniex.com/public?command=returnLoanOrders¤cy=XMR&limit=999999"
|
poloxmrlendurl = "https://poloniex.com/public?command=returnLoanOrders¤cy=XMR&limit=999999"
|
||||||
|
@ -155,6 +156,24 @@ def gecko(bot, trigger):
|
||||||
except:
|
except:
|
||||||
bot.say("Couldn't find {} on le gecko".format(coin))
|
bot.say("Couldn't find {} on le gecko".format(coin))
|
||||||
|
|
||||||
|
@sopel.module.commands('coin', 'coinex')
|
||||||
|
def coinex(bot, trigger):
|
||||||
|
if not trigger.group(2):
|
||||||
|
bot.say(".coin <coin-name> <currency-code>")
|
||||||
|
else:
|
||||||
|
try:
|
||||||
|
coinname = trigger.group(2).split(" ")[0]
|
||||||
|
currencyname = trigger.group(2).split(" ")[1]
|
||||||
|
r = requests.get(
|
||||||
|
'https://api.coingecko.com/api/v3/coins/markets?vs_currency={0}&ids={1}&sparkline=false'.
|
||||||
|
format(currencyname, coinname))
|
||||||
|
j = r.json()
|
||||||
|
bot.say("{0} price {1:,.2f} {2}".format(j[0]['name'],
|
||||||
|
float(
|
||||||
|
j[0]['current_price']),
|
||||||
|
currencyname.upper()))
|
||||||
|
except:
|
||||||
|
bot.say("Failed to retrieve price.")
|
||||||
|
|
||||||
@sopel.module.commands('krak', 'kraken')
|
@sopel.module.commands('krak', 'kraken')
|
||||||
def krak(bot, trigger):
|
def krak(bot, trigger):
|
||||||
|
@ -509,6 +528,61 @@ def tall(bot, trigger):
|
||||||
# Send the tickers to IRC
|
# Send the tickers to IRC
|
||||||
bot.say(stringtosend[:-2])
|
bot.say(stringtosend[:-2])
|
||||||
|
|
||||||
|
addys = []
|
||||||
|
@sopel.module.commands('uni')
|
||||||
|
def uni(bot, trigger):
|
||||||
|
addy = trigger.group(2)
|
||||||
|
if len(addy) == 42 and addy[0:2] == "0x":
|
||||||
|
try:
|
||||||
|
r = requests.get("https://api.ethplorer.io/getTokenInfo/{}?apiKey=freekey".format(addy))
|
||||||
|
j = r.json()
|
||||||
|
name = j["name"]
|
||||||
|
symbol = j["symbol"]
|
||||||
|
holders = j["holdersCount"]
|
||||||
|
price = j["price"]["rate"]
|
||||||
|
mcap = j["price"]["marketCapUsd"]
|
||||||
|
vol = j["price"]["volume24h"]
|
||||||
|
bot.say("{} ({}) last price ${:.2f} on {:.2e} vol. Marketcap is ${:.2e} with {:.0f} addresses holding.".format(name, symbol, price, vol, mcap, holders))
|
||||||
|
existflag = False
|
||||||
|
for i in addys:
|
||||||
|
if i[0] == addy:
|
||||||
|
existflag == True
|
||||||
|
if not existflag:
|
||||||
|
addys.append([addy, name, symbol])
|
||||||
|
except:
|
||||||
|
bot.say("Can't find this piece of trash")
|
||||||
|
return
|
||||||
|
else:
|
||||||
|
existflag = False
|
||||||
|
for i in addys:
|
||||||
|
if addy == i[1] or addy == i[2]:
|
||||||
|
addy = i[0]
|
||||||
|
existflag = True
|
||||||
|
if not existflag:
|
||||||
|
bot.say("Can't find {}".format(addy))
|
||||||
|
return
|
||||||
|
try:
|
||||||
|
r = requests.get("https://api.ethplorer.io/getTokenInfo/{}?apiKey=freekey".format(addy))
|
||||||
|
j = r.json()
|
||||||
|
name = j["name"]
|
||||||
|
symbol = j["symbol"]
|
||||||
|
holders = j["holdersCount"]
|
||||||
|
price = j["price"]["rate"]
|
||||||
|
mcap = j["price"]["marketCapUsd"]
|
||||||
|
vol = j["price"]["volume24h"]
|
||||||
|
bot.say("{} ({}) last price ${:.2f} on {:.2e} vol. Marketcap is ${:.2e} with {:.0f} addresses holding.".format(name, symbol, price, vol, mcap, holders))
|
||||||
|
existflag = False
|
||||||
|
for i in addys:
|
||||||
|
if i[0] == addy:
|
||||||
|
existflag == True
|
||||||
|
if not existflag:
|
||||||
|
addys.append([addy, name, symbol])
|
||||||
|
except:
|
||||||
|
bot.say("Can't find this piece of trash")
|
||||||
|
return
|
||||||
|
with open('addys.csv', 'w') as f:
|
||||||
|
writer = csv.writer(f)
|
||||||
|
writer.writerows(addys)
|
||||||
|
|
||||||
@sopel.module.commands('usd')
|
@sopel.module.commands('usd')
|
||||||
def usd(bot, trigger):
|
def usd(bot, trigger):
|
||||||
|
|
16
trifling.py
16
trifling.py
|
@ -890,12 +890,12 @@ def weather(bot, trigger):
|
||||||
except:
|
except:
|
||||||
bot.say("The earth is on fire 🌎🔥")
|
bot.say("The earth is on fire 🌎🔥")
|
||||||
|
|
||||||
@sopel.module.commands('yeezy')
|
@sopel.module.commands('yeezy', 'kanye', 'ye')
|
||||||
def yeezy(bot, trigger):
|
def yeezy(bot, trigger):
|
||||||
headers = {'User-Agent': 'monerobux-irc-bot-#wownero'}
|
#headers = {'User-Agent': 'monerobux-irc-bot-#wownero'}
|
||||||
resp = requests.get('https://api.kanye.rest', headers=headers, timeout=3)
|
r = requests.get('https://api.kanye.rest')
|
||||||
resp.raise_for_status()
|
#resp.raise_for_status()
|
||||||
blob = resp.json()
|
j = r.json()
|
||||||
if 'quote' not in blob or not isinstance(blob['quote'], str):
|
#if 'quote' not in blob or not isinstance(blob['quote'], str):
|
||||||
raise Exception('malformed response')
|
# raise Exception('malformed response')
|
||||||
bot.say(blob['quote'])
|
bot.say(j['quote'])
|
||||||
|
|
Loading…
Reference in New Issue