Corona: fix --top10 reply order

This commit is contained in:
oddluck 2020-03-27 23:06:15 +00:00
parent f530068836
commit aa05fac3e4

View File

@ -584,18 +584,17 @@ class Corona(callbacks.Plugin):
self.time_created(updated))) self.time_created(updated)))
else: else:
reply = '' reply = ''
n = 0 n = 1
for country in self.data: for country in self.data:
if country == 'Total:': if n > 10:
continue
if n > 9:
break break
reply += " {0}: \x1F{1}\x1F (\x0307{2}\x03/\x0304{3}\x03),".format( if self.data[country]['rank'] == "#{0}".format(n):
self.data[country]['rank'], reply += " {0}: \x1F{1}\x1F (\x0307{2}\x03/\x0304{3}\x03),".format(
self.data[country]['name'], self.data[country]['rank'],
'{:,}'.format(self.data[country]['total_cases']), self.data[country]['name'],
self.data[country]['total_deaths']) '{:,}'.format(self.data[country]['total_cases']),
n += 1 self.data[country]['total_deaths'])
n += 1
reply = reply.strip().strip(',') reply = reply.strip().strip(',')
irc.reply("\x02{0} | Updated: {1}".format(reply, self.time_created(updated))) irc.reply("\x02{0} | Updated: {1}".format(reply, self.time_created(updated)))