refactor to be uber profesh
This commit is contained in:
parent
c91ef2b935
commit
101ec90dbb
24
trifling.py
24
trifling.py
|
@ -170,7 +170,7 @@ def collect(bot, trigger):
|
||||||
# the values in Prices must be ints or floats, of course
|
# the values in Prices must be ints or floats, of course
|
||||||
bot.say("Couldn't convert item value to a float! How?!? Why?!?")
|
bot.say("Couldn't convert item value to a float! How?!? Why?!?")
|
||||||
return
|
return
|
||||||
|
|
||||||
value_of_items_collected_in_one_day = quantity * value_of_one_item
|
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
|
weekly_coins_to_buy = value_of_items_collected_in_one_day * 7 / coin_price
|
||||||
|
|
||||||
|
@ -853,11 +853,11 @@ def whaleornot(bot, trigger):
|
||||||
@sopel.module.commands('trebuchet')
|
@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.")
|
bot.say("Can YOU use a counterweight to launch a 90 kg projectile over 300 meters? Yeah, I thought not.")
|
||||||
|
|
||||||
@sopel.module.commands('baka')
|
@sopel.module.commands('baka')
|
||||||
def baka(bot, trigger):
|
def baka(bot, trigger):
|
||||||
bot.say('https://www.youtube.com/watch?v=n5n7CSGPzqw')
|
bot.say('https://www.youtube.com/watch?v=n5n7CSGPzqw')
|
||||||
|
|
||||||
@sopel.module.commands('btcdwed')
|
@sopel.module.commands('btcdwed')
|
||||||
def btcdwed(bot, trigger):
|
def btcdwed(bot, trigger):
|
||||||
bot.say('https://www.youtube.com/watch?v=JZYZoQQ6LJQ')
|
bot.say('https://www.youtube.com/watch?v=JZYZoQQ6LJQ')
|
||||||
|
@ -865,16 +865,16 @@ def btcdwed(bot, trigger):
|
||||||
@sopel.module.commands('wayshegoes')
|
@sopel.module.commands('wayshegoes')
|
||||||
def wayshegoes(bot, trigger):
|
def wayshegoes(bot, trigger):
|
||||||
bot.say('https://www.youtube.com/watch?v=3SpihGKmYgY')
|
bot.say('https://www.youtube.com/watch?v=3SpihGKmYgY')
|
||||||
|
|
||||||
@sopel.module.commands('weather')
|
@sopel.module.commands('weather')
|
||||||
def weather(bot, trigger):
|
def weather(bot, trigger):
|
||||||
wk = client.weather_key
|
wk = client.weather_key
|
||||||
try:
|
try:
|
||||||
if not trigger.group(2):
|
if not trigger.group(2):
|
||||||
location = q="san%20francisco"
|
location = q="san%20francisco"
|
||||||
elif trigger.group(2) == 'nioc':
|
elif trigger.group(2) == 'nioc':
|
||||||
location = 'new york city'
|
location = 'new york city'
|
||||||
else:
|
else:
|
||||||
location = trigger.group(2)
|
location = trigger.group(2)
|
||||||
if location.isdigit():
|
if location.isdigit():
|
||||||
location = "zip="+location
|
location = "zip="+location
|
||||||
|
@ -892,8 +892,10 @@ def weather(bot, trigger):
|
||||||
|
|
||||||
@sopel.module.commands('yeezy')
|
@sopel.module.commands('yeezy')
|
||||||
def yeezy(bot, trigger):
|
def yeezy(bot, trigger):
|
||||||
try:
|
headers = {'User-Agent': 'monerobux-irc-bot-#wownero'}
|
||||||
res = requests.get('https://api.kanye.rest')
|
resp = requests.get('https://api.kanye.rest', headers=headers, timeout=3)
|
||||||
bot.say(res.json()['quote'])
|
resp.raise_for_status()
|
||||||
except Exception as e:
|
blob = resp.json()
|
||||||
bot.say('borked: {}'.format(e)
|
if 'quote' not in blob or not isinstance(blob['quote'], str):
|
||||||
|
raise Exception('malformed response')
|
||||||
|
bot.say(blob['quote'])
|
||||||
|
|
Loading…
Reference in New Issue