Compare commits

...

4 Commits

Author SHA1 Message Date
root 77fcdad55d fix ye 2020-09-23 23:58:35 +00:00
jw 7db20d993d
Merge pull request #48 from lalanza808/patch-3
add .yeezy
2020-09-23 16:54:14 -07:00
lza_menace 101ec90dbb refactor to be uber profesh 2020-09-23 12:11:16 -07:00
lalanza808 c91ef2b935
add .yeezy 2020-09-23 11:20:03 -07:00
3 changed files with 114 additions and 6 deletions

View File

@ -95,3 +95,27 @@ def solo(bot, trigger):
@sopel.module.commands('b2x')
def b2x(bot, trigger):
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)

View File

@ -6,6 +6,7 @@ import random
import datetime
import re
import client
import csv
polourl = "https://poloniex.com/public?command=returnTicker"
poloxmrlendurl = "https://poloniex.com/public?command=returnLoanOrders&currency=XMR&limit=999999"
@ -155,6 +156,24 @@ def gecko(bot, trigger):
except:
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')
def krak(bot, trigger):
@ -509,6 +528,61 @@ def tall(bot, trigger):
# Send the tickers to IRC
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')
def usd(bot, trigger):

View File

@ -889,3 +889,13 @@ def weather(bot, trigger):
except:
bot.say("The earth is on fire 🌎🔥")
@sopel.module.commands('yeezy', 'kanye', 'ye')
def yeezy(bot, trigger):
#headers = {'User-Agent': 'monerobux-irc-bot-#wownero'}
r = requests.get('https://api.kanye.rest')
#resp.raise_for_status()
j = r.json()
#if 'quote' not in blob or not isinstance(blob['quote'], str):
# raise Exception('malformed response')
bot.say(j['quote'])