Compare commits

...

11 Commits

Author SHA1 Message Date
jw 88c8827552
Merge pull request #61 from Cactii1/master
Add .smile trigger and fix mental trigger...
2021-07-11 11:47:49 -04:00
jw e54028b41e
Merge pull request #65 from scoobybejesus/patch-11
weather updates & weatherf
2021-07-11 11:47:40 -04:00
jw 111ea3e2e3
Merge pull request #64 from scoobybejesus/patch-10
Python3 update mostly. Removed sopel dups also.
2021-07-11 11:47:31 -04:00
jw 224b2c1604
Merge pull request #63 from scoobybejesus/patch-9
Make friendly for python3
2021-07-11 11:47:22 -04:00
jw 6bc3640c47
Merge pull request #62 from scoobybejesus/patch-8
Two ways to make python3 happy
2021-07-11 11:47:12 -04:00
scoobybejesus 59111f37d7
Fixed direction math. Whoops 2021-07-08 19:40:41 -04:00
scoobybejesus 213591e564
weather updates & weatherf
Add weatherf for farenheit and mph. For both, add wind direction. Break out vars to read easier.
2021-07-07 21:58:47 -04:00
scoobybejesus 322699ec02
Python3 update mostly. Removed sopel dups also.
Python3 syntax and removed sopel duplicates like unflip, shrug, lenny
2021-07-07 21:52:49 -04:00
scoobybejesus 316e8aa016
Make friendly for python3
python3 syntax
2021-07-07 21:39:27 -04:00
scoobybejesus aeb970f930
Two ways to make python3 happy
python3 syntax
2021-07-07 21:31:46 -04:00
Cactii1 1445a58039
Update trifling.py 2021-06-10 21:22:45 +02:00
3 changed files with 138 additions and 80 deletions

View File

@ -20,7 +20,7 @@ def fork(bot, trigger):
try:
r=requests.get(networkurl)
j=r.json()
except Exception,e:
except Exception as e:
pass
try:
height=j["height"]
@ -37,7 +37,7 @@ def network(bot, trigger):
try:
r=requests.get(networkurl)
j=r.json()
except Exception,e:
except:
pass
try:
height=j["height"]

View File

@ -225,10 +225,10 @@ def krak(bot, trigger):
try:
r=requests.get(kraktrig+coin+'XBT')
j=r.json()
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:
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")
try:
try:
bot.say(stringtosay)
except:
bot.say("Error getting data")
@ -243,11 +243,11 @@ def lending(bot, trigger):
currenttime=time.time()
for i in j['offers']:
amnt+=float(i['amount'])
bot.say("Total amount of XMR available {0:,.2f}. Changed by {1:.2f} in the last {2:.2f} hours".format(amnt, amnt-prevamnt, (currenttime-prevtime)/3600))
global prevamnt
prevamnt=amnt
global prevtime
prevtime=currenttime
bot.say("Total amount of XMR available {0:,.2f}. Changed by {1:.2f} in the last {2:.2f} hours".format(amnt, amnt-prevamnt, (currenttime-prevtime)/3600))
except:
bot.say("Something bad happened :o")
@ -276,7 +276,6 @@ def metal(bot, trigger):
@sopel.module.commands('polo', 'poloniex', 'marco', 'plol')
@sopel.module.interval(3600)
def polo(bot, trigger):
if not trigger.group(2):
try:
@ -290,21 +289,21 @@ def polo(bot, trigger):
sign = '+'
else:
sign = ''
face = ''
face = u'\u0000'
if change > 0.10:
face = u'\u263d'.encode('utf8')
face = u'\u263d'
if 0.10 >= change > 0.05:
face = u'\u2661'.encode('utf8')
face = u'\u2661'
if 0.05 >= change > 0.02:
face = u'\u263a'.encode('utf8')
face = u'\u263a'
if 0.02 >= change > -0.02:
face = u'\u2694'.encode('utf8')
face = u'\u2694'
if -0.02 >= change > -0.05:
face = u'\u2639'.encode('utf8')
face = u'\u2639'
if -0.05 >= change > -0.1:
face = u'\u2620'.encode('utf8')
face = u'\u2620'
if change < -0.1:
face = u'\u262d'.encode('utf8')
face = u'\u262d'
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:
bot.say("Error retrieving data from Poloniex")
@ -469,8 +468,8 @@ def top(bot, trigger):
elif limit < 1:
bot.say("Dude...")
return
r = requests.get('https://api.coingecko.com/api/v3/coins/markets?vs_currency=usd&order=market_cap_desc&per_page={}&page=1&sparkline=false'.format(limit))
j = r.json()
r = requests.get('https://api.coingecko.com/api/v3/coins/markets?vs_currency=usd&order=market_cap_desc&per_page={}&page=1&sparkline=false'.format(limit))
j = r.json()
for i in j:
symbol = i['symbol']
name = i['name']
@ -519,7 +518,7 @@ def tall(bot, trigger):
stampresult = requests.get(stampurl)
stampjson = stampresult.json()
except:
stampjson = False
stampjson = False
if stampjson:
stringtosend += "Bitstamp last: ${0:,.2f}, vol: {1:,.1f} | ".format(float(stampjson['last']), float(stampjson['volume']))
# Gemini
@ -527,7 +526,7 @@ def tall(bot, trigger):
gemiresult = requests.get(gemiurl)
gemijson = gemiresult.json()
except:
gemijson = False
gemijson = False
if gemijson:
try:
stringtosend += "Gemini last: ${0:,.2f}, vol: {1:,.1f} | ".format(float(gemijson['last']), float(gemijson['volume']['BTC']))
@ -540,7 +539,7 @@ def tall(bot, trigger):
gdaxprice = float(gdaxjson['price'])
gdaxvolume = float(gdaxjson['volume'])
except:
gdaxjson = False
gdaxjson = False
if gdaxjson:
stringtosend += "CBP last: ${0:,.2f}, vol: {1:,.1f} | ".format(gdaxprice, gdaxvolume)
# Binance
@ -552,7 +551,7 @@ def tall(bot, trigger):
binanceprice = float(i['lastPrice'])
binancevolume = float(i['volume'])
except:
binancejson = False
binancejson = False
if binancejson:
stringtosend += "Binance last: ${0:,.2f}, vol: {1:,.1f} | ".format(binanceprice, binancevolume)
# Bitfinex
@ -560,7 +559,7 @@ def tall(bot, trigger):
finexresult = requests.get(finexurl)
finexjson = finexresult.json()
except:
finexjson = False
finexjson = False
try:
if finexjson:
stringtosend += "Bitfinex last: ${0:,.2f}, vol: {1:,.1f} | ".format(float(finexjson['last_price']), float(finexjson['volume']))
@ -659,13 +658,13 @@ def xmrtall(bot, trigger):
# Polo
try:
r=requests.get(polourl)
r=requests.get(polourl)
j=r.json()
xmr=j["BTC_XMR"]
last=float(xmr['last'])
# change=float(xmr['percentChange'])
vol=float(xmr['baseVolume'])
stringtosend += "Poloniex last: {0:.6f} BTC on {1:.2f} BTC volume | ".format(last, vol)
stringtosend += "Poloniex last: {0:.6f} BTC on {1:.2f} BTC volume | ".format(last, vol)
except:
bot.say("Something borked ¯\(º_o)/¯")

View File

@ -6,7 +6,7 @@ import requests
import praw
import client
from threading import Timer
from HTMLParser import HTMLParser
from html.parser import HTMLParser
@sopel.module.commands('4matter')
def fourmatter(bot, trigger):
@ -77,7 +77,7 @@ def bbl(bot, trigger):
@sopel.module.commands('bear')
def bear(bot, trigger):
bot.say(u'ʕ ·(エ)· ʔ'.encode('utf8'))
bot.say(u'ʕ ·(エ)· ʔ')
@sopel.module.commands('billions')
def billions(bot, trigger):
@ -85,11 +85,11 @@ def billions(bot, trigger):
@sopel.module.commands('brothers')
def brothers(bot, trigger):
bot.say(u'http://www.trollaxor.com/2011/11/brief-history-of-ascii-penis.html'.encode('utf8'))
bot.say(u'http://www.trollaxor.com/2011/11/brief-history-of-ascii-penis.html')
@sopel.module.commands('bp', 'bps', 'bulletproof', 'bulletproofs')
def bulletproofs(bot, trigger):
bot.say(u'https://www.youtube.com/watch?v=Kk8eJh4i8Lo'.encode('utf8'))
bot.say(u'https://www.youtube.com/watch?v=Kk8eJh4i8Lo')
@sopel.module.commands('buyorsell')
def buyorsell(bot, trigger):
@ -186,7 +186,7 @@ def collect(bot, trigger):
value_of_items_collected_in_one_day = quantity * value_of_one_item
weekly_coins_to_buy = value_of_items_collected_in_one_day * 7 / coin_price
bot.say('{0} price: ${1:,.2f}, and {2} price: ${3:,.3f}'.format(item.capitalize(), value_of_one_item, coin.capitalize(), coin_price))
bot.say('{0} price: ${1:,.2f}, and {2} price: ${3:,.2f}'.format(item.capitalize(), value_of_one_item, coin.capitalize(), coin_price))
bot.say('{0}: collect {1} per day to exchange for {2:,.5f} {3} each week!'.format(item.capitalize(), quantity, weekly_coins_to_buy, coin))
@sopel.module.commands('covid', 'corona', 'conv')
@ -247,7 +247,7 @@ def dash(bot, trigger):
@sopel.module.commands('dealwithit')
def dealwithit(bot, trigger):
bot.say(u'(•_•) ( •_•)>⌐■-■ (⌐■_■)'.encode('utf8'))
bot.say(u'(•_•) ( •_•)>⌐■-■ (⌐■_■)')
@sopel.module.commands('Deathtobitcoin', 'Deathtobitcoin2')
def deathtobitcoin2(bot, trigger):
@ -255,11 +255,11 @@ def deathtobitcoin2(bot, trigger):
@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'))
bot.say(u'http://www.contravex.com/2016/06/29/from-the-scammer-files-anthony-di-iorio/')
@sopel.module.commands('disapprove')
def disapprove(bot, trigger):
bot.say(u'ಠ_ಠ'.encode('utf8'))
bot.say(u'ಠ_ಠ')
@sopel.module.commands('ded')
def ded(bot, trigger):
@ -283,19 +283,19 @@ def encrypt(bot, trigger):
@sopel.module.commands('eth')
def eth(bot, trigger):
bot.say(u'The world computer 💻🌐'.encode('utf8'))
bot.say(u'The world computer 💻🌐')
@sopel.module.commands('ferret', 'ferretinjapan')
def ferret(bot, trigger):
bot.say(u'♥‿♥ https://crypto314.com/wp-content/uploads/2017/09/monero-1505185532555-723x1024.png ♥‿♥'.encode('utf8'))
bot.say(u'♥‿♥ https://crypto314.com/wp-content/uploads/2017/09/monero-1505185532555-723x1024.png ♥‿♥')
@sopel.module.commands('fib', 'fibonacci')
def fib(bot, trigger):
bot.say(u'Pardon me, do you have a moment to discuss our lord and savior ✞Cheesus Monero✞?'.encode('utf8'))
bot.say(u'Pardon me, do you have a moment to discuss our lord and savior ✞Cheesus Monero✞?')
@sopel.module.commands('flip')
def flip(bot, trigger):
bot.say(u'(╯°□°)╯︵ ┻━┻'.encode('utf8'))
bot.say(u'(╯°□°)╯︵ ┻━┻')
@sopel.module.commands('fuck')
def fuck(bot, trigger):
@ -381,7 +381,7 @@ def jaxx(bot, trigger):
bot.say(u'This command will be implemented soon. Honest. Especially if the devs can provide some unpaid assistance. Soon™...')
@sopel.module.commands('jimbell')
def jaxx(bot, trigger):
def jimbell(bot, trigger):
if not trigger.group(2):
bot.say(u'https://en.wikipedia.org/wiki/Jim_Bell')
else:
@ -409,19 +409,15 @@ def kramer(bot, trigger):
@sopel.module.commands('lambo')
def lambo(bot, trigger):
bot.say(u'Our mission is to give you a taste of the lambo dream 🏎 '.encode('utf8'))
@sopel.module.commands('lenny')
def lenny(bot, trigger):
bot.say(u'( ͡° ͜ʖ ͡°)'.encode('utf8'))
bot.say(u'Our mission is to give you a taste of the lambo dream 🏎 ')
@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')
@sopel.module.commands('livermore')
def livermore(bot, trigger):
bot.say(u'https://en.wikipedia.org/wiki/Reminiscences_of_a_Stock_Operator'.encode('utf8'))
bot.say(u'https://en.wikipedia.org/wiki/Reminiscences_of_a_Stock_Operator')
@sopel.module.commands('loki')
def loki(bot, trigger):
@ -429,11 +425,11 @@ def loki(bot, trigger):
@sopel.module.commands('luigi')
def luigi(bot, trigger):
bot.say(u'🍄 luigi is doing. mario is not doing luigi is doing 🍄'.encode('utf8'))
bot.say(u'🍄 luigi is doing. mario is not doing luigi is doing 🍄')
@sopel.module.commands('ltc', 'chikun')
def ltc(bot, trigger):
bot.say(u'🐔🐔🐔 https://cdn.meme.am/cache/instances/folder100/48222100.jpg 🐔🐔🐔'.encode('utf8'))
bot.say(u'🐔🐔🐔 https://cdn.meme.am/cache/instances/folder100/48222100.jpg 🐔🐔🐔')
@sopel.module.commands('major')
def major(bot, trigger):
@ -445,43 +441,43 @@ def masternode(bot, trigger):
@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'))
bot.say(u"🔒🔒🔒 MoneroV is more secured than others. That's why it is better invest on moneroV. 💰💰💰")
@sopel.module.commands('moon')
def moon(bot, trigger):
bot.say(u'┗(°0°)┛'.encode('utf8'))
bot.say(u'┗(°0°)┛')
@sopel.module.commands('multisig')
def multisig(bot, trigger):
bot.say(u'𝓼𝓲𝓰𝓷𝓪𝓽𝓾𝓻𝓮 𝓼𝓲𝓰𝓷𝓪𝓽𝓾𝓻𝓮'.encode('utf8'))
bot.say(u'𝓼𝓲𝓰𝓷𝓪𝓽𝓾𝓻𝓮 𝓼𝓲𝓰𝓷𝓪𝓽𝓾𝓻𝓮')
@sopel.module.commands('myriad', 'myr', 'myriadcoin')
def myriad(bot, trigger):
bot.say(u'Myriad - A coin for everyone 🖐'.encode('utf8'))
bot.say(u'Myriad - A coin for everyone 🖐')
@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'))
bot.say(u'cash rules everything around me C.R.E.A.M get the money 💵 💵 bill yall')
@sopel.module.commands('nioc')
def nioc(bot, trigger):
bot.say(u'https://ifunny.co/fun/laeIohx56'.encode('utf8'))
bot.say(u'https://ifunny.co/fun/laeIohx56')
@sopel.module.commands('nobody')
def nobody(bot, trigger):
bot.say('https://www.youtube.com/watch?v=YA631bMT9g8')
@sopel.module.commands('nomnomnom')
@sopel.module.commands('nomnomnom', 'nomnom')
def nomnomnom(bot, trigger):
bot.say(u'ᗧ•••ᗣ'.encode('utf8'))
bot.say(u'ᗧ•••ᗣ')
@sopel.module.commands('noom')
def noom(bot, trigger):
bot.say(u'┏(.0.)┓'.encode('utf8'))
bot.say(u'┏(.0.)┓')
@sopel.module.commands('notbad', 'dorian')
def notbad(bot, trigger):
bot.say(u'(´ー`) http://hackingdistributed.com/images/2014-01-01-bitcoin/dorian1.jpg (´ー`)'.encode('utf8'))
bot.say(u'(´ー`) http://hackingdistributed.com/images/2014-01-01-bitcoin/dorian1.jpg (´ー`)')
@sopel.module.commands('obama')
def obama(bot, trigger):
@ -557,7 +553,7 @@ def projecting(bot, trigger):
@sopel.module.commands('purge')
def purge(bot, trigger):
bot.say(u'♔♔♔ Bow to the king https://preview.redd.it/fr8q7x9utnzy.png?width=612&auto=webp&s=8bf7aa7674d2dc3157b776ae07771144833cd879 ♔♔♔'.encode('utf8'))
bot.say(u'♔♔♔ Bow to the king https://preview.redd.it/fr8q7x9utnzy.png?width=612&auto=webp&s=8bf7aa7674d2dc3157b776ae07771144833cd879 ♔♔♔')
@sopel.module.commands('rarepepe', 'rare')
def rarepepe(bot, trigger):
@ -579,11 +575,11 @@ def rarepepe(bot, trigger):
@sopel.module.commands('rip')
def rip(bot, trigger):
bot.say(u'(X_X) ☜ (◉▂◉ ) we hardly knew ye'.encode('utf8'))
bot.say(u'(X_X) ☜ (◉▂◉ ) we hardly knew ye')
@sopel.module.commands('risto', 'rpietila')
def risto(bot, trigger):
bot.say(u'Zionists own the media, including Hollywood. It is nothing extraordinary for them to use it to further their goals. Just see what they are propagating every day in every media outlet. And the compulsory disclaimer: Zionist != Jew. Zionists in my understanding are typically mostly not even ethnic Jews, and the supermajority of Jews certainly are not Zionists. Zionism is a purely political supremacy movement.'.encode('utf8'))
bot.say(u'Zionists own the media, including Hollywood. It is nothing extraordinary for them to use it to further their goals. Just see what they are propagating every day in every media outlet. And the compulsory disclaimer: Zionist != Jew. Zionists in my understanding are typically mostly not even ethnic Jews, and the supermajority of Jews certainly are not Zionists. Zionism is a purely political supremacy movement.')
@sopel.module.commands('romerito', 'romero')
def romerito(bot, trigger):
@ -631,19 +627,15 @@ def scam(bot, trigger):
@sopel.module.commands('soon')
def soon(bot, trigger):
bot.say(u'Two weeks™'.encode('utf8'))
bot.say(u'Two weeks™')
@sopel.module.commands('shillo', 'cid')
def shillo(bot, trigger):
bot.say(u'☠☠☠ Crypto is ded https://i.kym-cdn.com/photos/images/original/001/321/553/f03.jpg ☠☠☠ '.encode('utf8'))
@sopel.module.commands('shrug')
def shrug(bot, trigger):
bot.say(u'¯\_(ツ)_/¯'.encode('utf8'))
bot.say(u'☠☠☠ Crypto is ded https://i.kym-cdn.com/photos/images/original/001/321/553/f03.jpg ☠☠☠ ')
@sopel.module.commands('softich')
def softich(bot, trigger):
bot.say(u'🐻🐻🐻 https://imgflip.com/i/1ve397 🐻🐻🐻'.encode('utf8'))
bot.say(u'🐻🐻🐻 https://imgflip.com/i/1ve397 🐻🐻🐻')
@sopel.module.commands('summon')
def summon(bot, trigger):
@ -691,14 +683,14 @@ def trivia(bot, trigger):
category = j['results'][0]['category']
difficulty = j['results'][0]['difficulty']
question = h.unescape(j['results'][0]['question'])
answers = [j['results'][0]['correct_answer']]
for i in j['results'][0]['incorrect_answers']:
answers.append(i)
random.shuffle(answers)
answers = [j['results'][0]['correct_answer']]
for i in j['results'][0]['incorrect_answers']:
answers.append(i)
random.shuffle(answers)
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))
bot.say("The possible answers are: {}, {}, {}, or {}".format(answers[0], answers[1], answers[2], answers[3]))
bot.say("The possible answers are: {}, {}, {}, or {}".format(answers[0], answers[1], answers[2], answers[3]))
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)
@ -729,10 +721,6 @@ def trump(bot, trigger):
def trumbleweed(bot, trigger):
bot.say("https://rootco.de/2016-03-28-why-use-tumbleweed/")
@sopel.module.commands('unflip')
def unflip(bot, trigger):
bot.say(u'┬─┬ノ( º _ ºノ)'.encode('utf8'))
urmomoptions = [
"ur mom is so stupid she bought all the dash",
"ur momma got a peg leg with a kickstand",
@ -756,7 +744,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'))
bot.say(u"👻🐕 Don't wraith my dark doge bro! 👻🐕")
vitalikoptions = [
"https://pbs.twimg.com/media/CrWjczJXgAExF2S.jpg",
@ -802,7 +790,7 @@ def test(bot, trigger):
@sopel.module.rule('monerobux o\/')
def wave(bot, trigger):
#bot.reply(u'^ (•_•) ^'.encode('utf8'))
#bot.reply(u'^ (•_•) ^')
bot.reply('hello')
#@sopel.module.rule('[Tt]rump')
#def politics(bot, trigger):
@ -900,16 +888,83 @@ def weather(bot, trigger):
location = "zip="+location
else:
location = "q="+location.replace(' ', '%20')
r = requests.get('https://api.openweathermap.org/data/2.5/weather?{}&appid={}'.format(location, wk))
j = r.json()
location = j['name']+', '+j['sys']['country']
humidity = j['main']['humidity']
wind_speed_m_s = j['wind']['speed']
wind_deg = j['wind']['deg']
description = j['weather'][0]['description']
temp_in_c = float(j['main']['temp'])-273
low_in_c = float(j['main']['temp_min'])-273
high_in_c = float(j['main']['temp_max'])-273
temp = temp_in_c
low = low_in_c
high = high_in_c
def calculate_bearing(d):
dirs = ['N', 'NNE', 'NE', 'ENE', 'E', 'ESE', 'SE', 'SSE', 'S', 'SSW', 'SW', 'WSW', 'W', 'WNW', 'NW', 'NNW']
ix = int(round(d / (360. / len(dirs))))
return dirs[(ix) % len(dirs)]
direction = calculate_bearing(wind_deg)
try:
bot.say("In {} it is {:.2f} C with a low of {:.2f} and high of {:.2f} C, humidity is {}%, winds of {} m/s at an angle of {} deg with {}.".format(j['name']+', '+j['sys']['country'], float(j['main']['temp'])-273, float(j['main']['temp_min'])-273, float(j['main']['temp_max'])-273, j['main']['humidity'], j['wind']['speed'], j['wind']['deg'], j['weather'][0]['description']))
bot.say("In {} it is {:.1f} C with a low of {:.1f} and high of {:.1f} C, humidity is {}%, winds of {} m/s from the {} with {}.".format(location, temp, low, high, humidity, wind_speed_m_s, direction, description))
except:
bot.say("In {} it is {:.2f} C with a low of {:.2f} and high of {:.2f} C, humidity is {}%, winds of {} m/s with {}.".format(j['name']+', '+j['sys']['country'], float(j['main']['temp'])-273, float(j['main']['temp_min'])-273, float(j['main']['temp_max'])-273, j['main']['humidity'], j['wind']['speed'], j['weather'][0]['description']))
bot.say("In {} it is {:.2f} C with a low of {:.2f} and high of {:.2f} C, humidity is {}%, winds of {} m/s with {}.".format(location, temp, low, high, humidity, wind_speed_m_s, description))
except:
bot.say("The earth is on fire 🌎🔥")
@sopel.module.commands('weatherf')
def weatherf(bot, trigger):
wk = client.weather_key
try:
if not trigger.group(2):
location = q="san%20francisco"
elif trigger.group(2) == 'nioc':
location = 'new york city'
else:
location = trigger.group(2)
if location.isdigit():
location = "zip="+location
else:
location = "q="+location.replace(' ', '%20')
r = requests.get('https://api.openweathermap.org/data/2.5/weather?{}&appid={}'.format(location, wk))
j = r.json()
location = j['name']+', '+j['sys']['country']
humidity = j['main']['humidity']
wind_speed_m_s = j['wind']['speed']
wind_deg = j['wind']['deg']
description = j['weather'][0]['description']
temp_in_c = float(j['main']['temp'])-273
low_in_c = float(j['main']['temp_min'])-273
high_in_c = float(j['main']['temp_max'])-273
temp = (temp_in_c * 9 / 5 ) + 32
low = (low_in_c * 9 / 5 ) + 32
high = (high_in_c * 9 / 5 ) + 32
wind_speed_mph = float(wind_speed_m_s) * 2.236936
def calculate_bearing(d):
dirs = ['N', 'NNE', 'NE', 'ENE', 'E', 'ESE', 'SE', 'SSE', 'S', 'SSW', 'SW', 'WSW', 'W', 'WNW', 'NW', 'NNW']
ix = int(round(d / (360. / len(dirs))))
return dirs[(ix) % len(dirs)]
direction = calculate_bearing(wind_deg)
try:
bot.say("In {} it is {:.1f} F with a low of {:.1f} and high of {:.1f} F, humidity is {}%, winds of {:.1f} mph from the {} with {}.".format(location, temp, low, high, humidity, wind_speed_mph, direction, description))
except:
bot.say("In {} it is {:.1f} F with a low of {:.1f} and high of {:.1f} F, humidity is {}%, winds of {:.1f} mph with {}.".format(location, temp, low, high, humidity, wind_speed_mph, description))
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'}
@ -925,5 +980,9 @@ def mental(bot, trigger):
bot.say('Ahhhhhhhh!!!!')
@sopel.module.commands('biden')
def mental(bot, trigger):
def biden(bot, trigger):
bot.say('Come on man...')
@sopel.module.commands('smile')
def smile(bot, trigger):
bot.say('https://archive.is/uqHxO')