Merge pull request #5 from jwinterm/master

merge
This commit is contained in:
ferretinjapan 2017-07-02 19:36:47 +09:30 committed by GitHub
commit 792490c230
3 changed files with 180 additions and 7 deletions

1
.gitignore vendored
View File

@ -1,2 +1,3 @@
client.py
*.pyc
apikey.py

View File

@ -3,6 +3,7 @@ import sopel.module
import requests
import time
import random
# from apikey import commodity_key
polourl = "https://poloniex.com/public?command=returnTicker"
poloxmrlendurl = "https://poloniex.com/public?command=returnLoanOrders&currency=XMR&limit=999999"
@ -20,6 +21,7 @@ krakusd = 'https://api.kraken.com/0/public/Ticker?pair=XMRUSD'
krakeur = 'https://api.kraken.com/0/public/Ticker?pair=XMREUR'
okcquar = 'https://www.okcoin.com/api/v1/future_ticker.do?symbol=btc_usd&contract_type=quarter'
krakusdt = 'http://api.kraken.com/0/public/Ticker?pair=USDTUSD'
bitflyerurl = 'https://api.bitflyer.jp/v1/ticker'
@sopel.module.commands('bfx', 'bitfinex')
def bfx(bot, trigger):
@ -175,6 +177,28 @@ def lending(bot, trigger):
except:
bot.say("Something bad happened :o")
@sopel.module.commands('btclending')
def btclending(bot, trigger):
try:
r=requests.get(polobtclendurl)
j=r.json()
amnt=0
amnt10=0
rate10=0
amnt100=0
rate100=0
for i in j['offers']:
if amnt < 10:
amnt10=amnt
rate10=float(i['rate'])
if amnt < 100:
amnt100=amnt
rate100=float(i['rate'])
amnt+=float(i['amount'])
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):
@ -288,6 +312,23 @@ def okc(bot, trigger):
except:
bot.say("Error retrieving data from OKCoin")
@sopel.module.commands('tux')
def tux(bot, trigger):
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'])
bot.say("{0} at {1:.8f} BTC on {2:.3f} BTC volume, changed {3:.2f}% over last 24 hr".format(ticker, last, vol, change))
except:
bot.say("Error retrieving data from Tuxexchange")
@sopel.module.commands('pepe', 'pepecash')
def pepe(bot, trigger):
try:
@ -328,13 +369,15 @@ def tall(bot, trigger):
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.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']
except:
usdcny = 7
# Bitstamp
@ -371,7 +414,7 @@ def tall(bot, trigger):
except:
gdaxjson = False
if gdaxjson:
stringtosend += "GDAX price: {0:,.2f} | ".format(float(gdaxjson['data']['rates']['USD']))
stringtosend += "GDAX price: {0:,.2f}, vol: {1:,.1f} | ".format(float(gdaxjson['price']), float(gdaxjson['volume']))
# Bitfinex
try:
finexresult = requests.get(finexurl)
@ -396,6 +439,14 @@ def tall(bot, trigger):
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)
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']))
# Send the tickers to IRC
bot.say(stringtosend)
@ -618,3 +669,28 @@ def price(bot, trigger):
bot.say("1 XMR = $1000 USD (Offer valid in participating locations)")
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_EGL'
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...")

View File

@ -5,6 +5,7 @@ import re
import requests
import praw
from client import *
from threading import Timer
@sopel.module.commands('4matter')
def fourmatter(bot, trigger):
@ -30,6 +31,10 @@ def bananas(bot, trigger):
def barolo(bot, trigger):
bot.say('I just opened a 2004 barolo in your and all the devs honor -- https://i.ytimg.com/vi/-JvdfsIeb-s/hqdefault.jpg')
@sopel.module.commands('bb')
def bb(bot, trigger):
bot.say('https://www.youtube.com/watch?v=_VvbP0QNmF0')
@sopel.module.commands('bear')
def bear(bot, trigger):
bot.say(u'ʕ ·(エ)· ʔ'.encode('utf8'))
@ -74,6 +79,10 @@ def dash(bot, trigger):
def dealwithit(bot, trigger):
bot.say(u'(•_•) ( •_•)>⌐■-■ (⌐■_■)'.encode('utf8'))
@sopel.module.commands('diiorio')
def diiorio(bot, trigger):
bot.say(u'http://www.contravex.com/2016/06/29/from-the-scammer-files-anthony-di-iorio/'.encode('utf8'))
@sopel.module.commands('disapprove')
def disapprove(bot, trigger):
bot.say(u'ಠ_ಠ'.encode('utf8'))
@ -127,6 +136,15 @@ def gay(bot, trigger):
def gui(bot, trigger):
bot.say('http://imgur.com/a/hnxfS')
hitleroptions = [
'https://www.youtube.com/watch?v=L2WfedZG7bo',
r"There's always Aeon",
'http://adolfcoin.camp/'
]
@sopel.module.commands('hitler', 'adolf')
def hitler(bot, trigger):
bot.say(random.choice(hitleroptions))
@sopel.module.commands('hmm', 'hmmm')
def hmm(bot, trigger):
# try:
@ -139,6 +157,14 @@ def hmm(bot, trigger):
# except:
# bot.say("Something something reddit's servers")
@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'))
@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.')
@sopel.module.commands('isittrue')
def isittrue(bot, trigger):
draw = random.random()
@ -165,15 +191,31 @@ def jwinterm(bot, trigger):
@sopel.module.commands('kid', 'rehrar')
def kid(bot, trigger):
bot.say(u'What up kid?')
@sopel.module.commands('kramer')
def kramer(bot, trigger):
bot.say("Waiting for a retrace to 0.007")
@sopel.module.commands('lenny')
def lenny(bot, trigger):
bot.say(u'( ͡° ͜ʖ ͡°)'.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'))
@sopel.module.commands('luigi')
def luigi(bot, trigger):
bot.say(u'🍄 luigi is doing. mario is not doing luigi is doing 🍄'.encode('utf8'))
@sopel.module.commands('ltc', 'chikun')
def ltc(bot, trigger):
bot.say(u'🐔🐔🐔 https://cdn.meme.am/cache/instances/folder100/48222100.jpg 🐔🐔🐔'.encode('utf8'))
@sopel.module.commands('major')
def major(bot, trigger):
bot.say(r"Showed them a sneak peak of the MAJOR Monero announcement that is happening at tomorrow's meetup, they're excited!")
@sopel.module.commands('masternode', 'masternodes')
def masternode(bot, trigger):
bot.say('http://hadoopilluminated.com/hadoop_illuminated/images/hdfs3.jpg')
@ -186,6 +228,18 @@ def moon(bot, trigger):
def multisig(bot, trigger):
bot.say(u'𝓼𝓲𝓰𝓷𝓪𝓽𝓾𝓻𝓮 𝓼𝓲𝓰𝓷𝓪𝓽𝓾𝓻𝓮'.encode('utf8'))
@sopel.module.commands('myriad', 'myr', 'myriadcoin')
def myriad(bot, trigger):
bot.say(u'Myriad - A coin for everyone 🖐'.encode('utf8'))
@sopel.module.commands('needmoney', 'needmoney90', 'nm90')
def needmoney(bot, trigger):
bot.say(u'cash rules everything around me C.R.E.A.M get the money 💵 💵 bill yall'.encode('utf8'))
@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'))
@sopel.module.commands('nomnomnom')
def nomnomnom(bot, trigger):
bot.say(u'ᗧ•••ᗣ'.encode('utf8'))
@ -201,8 +255,12 @@ odboptions = [
]
@sopel.module.commands('odb', 'oldirty')
def odb(bot, trigger):
bot.say(random.choice(confirmoptions))
bot.say(random.choice(odboptions))
@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'
@ -214,7 +272,15 @@ 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!")
confirmoptions = [
"I can confirm that it is true",
"This is true",
@ -288,6 +354,27 @@ def summon(bot, trigger):
def timetravelpp(bot, trigger):
bot.say("A journey is best measured in pepes, rather than miles http://rarepepedirectory.com/wp-content/uploads/2016/09/timetravelpepe.jpg")
@sopel.module.commands('trivia')
def trivia(bot, trigger):
try:
triviaurl = 'https://opentdb.com/api.php?amount=1&type=multiple'
r = requests.get(triviaurl)
j = r.json()
category = j['results'][0]['category']
difficulty = j['results'][0]['difficulty']
question = j['results'][0]['question']
correct_answer = j['results'][0]['correct_answer']
incorrect_answers = j['results'][0]['incorrect_answers']
bot.say("This question is in the field of {} and is of {} difficulty: {}".format(category, difficulty, question))
replystr = "If you said {} you are correct, but if you said {}, {}, or {} you should call your parents and complain.".format(correct_answer, incorrect_answers[0], incorrect_answers[1], incorrect_answers[2])
def f():
bot.say(replystr)
t = Timer(10.0, f)
t.start()
except:
bot.say("No trivia for you!")
reddit=praw.Reddit(client_id=client_id,
client_secret=client_secret,
user_agent='monerobux',
@ -310,7 +397,7 @@ def trump(bot, trigger):
bot.say("Monero is the best crypto, believe me, I know crypto and it's going to be yuuuuuuuge!")
@sopel.module.commands('tumbleweed')
def trump(bot, trigger):
def trumbleweed(bot, trigger):
bot.say("https://rootco.de/2016-03-28-why-use-tumbleweed/")
@sopel.module.commands('unflip')
@ -341,7 +428,8 @@ def urmom(bot, trigger):
vitalikoptions = [
"https://pbs.twimg.com/media/CrWjczJXgAExF2S.jpg",
"mETH, not even once: https://cdn-az.allevents.in/banners/e7df519e0808bac49fa3aaf503aff87d",
"Betteridge's law of headlines: https://fortunedotcom.files.wordpress.com/2016/09/blo_startups_2520x1667.png"
"Betteridge's law of headlines: https://fortunedotcom.files.wordpress.com/2016/09/blo_startups_2520x1667.png",
"Casper can survive 51% attacks happening once in a while; we can just delete the attackers' deposits and keep going."
]
@sopel.module.commands('vitalik', 'buterin')
def vitalik(bot, trigger):
@ -351,6 +439,10 @@ def vitalik(bot, trigger):
@sopel.module.commands('wat')
def wat(bot, trigger):
bot.say("https://www.destroyallsoftware.com/talks/wat")
@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.",
@ -360,6 +452,10 @@ zcashoptions = [
def zcash(bot, trigger):
bot.say(random.choice(zcashoptions))
@sopel.module.commands('zooko')
def zcash(bot, trigger):
bot.say("And by the way, I think we can successfully make Zcash too traceable for criminals like WannaCry, but still completely private & fungible.")
@sopel.module.rule('monerobux o\/')
def wave(bot, trigger):
#bot.reply(u'^ (•_•) ^'.encode('utf8'))
@ -367,7 +463,7 @@ def wave(bot, trigger):
#@sopel.module.rule('[Tt]rump')
#def politics(bot, trigger):
# bot.reply("politics is the mind killer")
@sopel.module.commands('asp')
def asp(bot, trigger):
polourl = "https://poloniex.com/public?command=returnTicker"