Make friendly for python3

python3 syntax
This commit is contained in:
scoobybejesus 2021-07-07 21:39:27 -04:00 committed by GitHub
parent 25e97a8b9b
commit 316e8aa016
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 21 additions and 22 deletions

View File

@ -243,11 +243,11 @@ def lending(bot, trigger):
currenttime=time.time() currenttime=time.time()
for i in j['offers']: for i in j['offers']:
amnt+=float(i['amount']) 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 global prevamnt
prevamnt=amnt prevamnt=amnt
global prevtime global prevtime
prevtime=currenttime 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: except:
bot.say("Something bad happened :o") bot.say("Something bad happened :o")
@ -276,7 +276,6 @@ def metal(bot, trigger):
@sopel.module.commands('polo', 'poloniex', 'marco', 'plol') @sopel.module.commands('polo', 'poloniex', 'marco', 'plol')
@sopel.module.interval(3600)
def polo(bot, trigger): def polo(bot, trigger):
if not trigger.group(2): if not trigger.group(2):
try: try:
@ -290,21 +289,21 @@ def polo(bot, trigger):
sign = '+' sign = '+'
else: else:
sign = '' sign = ''
face = '' face = u'\u0000'
if change > 0.10: if change > 0.10:
face = u'\u263d'.encode('utf8') face = u'\u263d'
if 0.10 >= change > 0.05: if 0.10 >= change > 0.05:
face = u'\u2661'.encode('utf8') face = u'\u2661'
if 0.05 >= change > 0.02: if 0.05 >= change > 0.02:
face = u'\u263a'.encode('utf8') face = u'\u263a'
if 0.02 >= change > -0.02: if 0.02 >= change > -0.02:
face = u'\u2694'.encode('utf8') face = u'\u2694'
if -0.02 >= change > -0.05: if -0.02 >= change > -0.05:
face = u'\u2639'.encode('utf8') face = u'\u2639'
if -0.05 >= change > -0.1: if -0.05 >= change > -0.1:
face = u'\u2620'.encode('utf8') face = u'\u2620'
if change < -0.1: 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)) 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: except:
bot.say("Error retrieving data from Poloniex") bot.say("Error retrieving data from Poloniex")