Fix current/total
This commit is contained in:
parent
536f50152d
commit
42bc7d0085
|
|
@ -55,7 +55,7 @@ class Metal(callbacks.Plugin):
|
|||
return "{} [{}/{}] {} | {} | {} | {}".format(
|
||||
self.prepend,
|
||||
position,
|
||||
total - 1,
|
||||
total,
|
||||
item['band'],
|
||||
item['genre'],
|
||||
item['country'],
|
||||
|
|
@ -85,18 +85,21 @@ class Metal(callbacks.Plugin):
|
|||
)
|
||||
result = json.loads(response.content.decode('utf-8'))
|
||||
|
||||
if result['iTotalRecords'] == 0:
|
||||
irc.reply('NOT METAL', prefixNick=False)
|
||||
position = position - 1
|
||||
total = result['iTotalRecords']
|
||||
|
||||
if total == 0:
|
||||
irc.error('NOT METAL', prefixNick=False)
|
||||
return
|
||||
|
||||
try:
|
||||
item = self.__parse_item(result['aaData'][position])
|
||||
except IndexError:
|
||||
irc.reply('NO HACKZ', prefixNick=False)
|
||||
irc.error('NO HACKZ', prefixNick=False)
|
||||
return
|
||||
|
||||
irc.reply(self.__format_message(item, position, result['iTotalRecords']), prefixNick=False)
|
||||
find = wrap(find, ['anything', optional('int', default=0)])
|
||||
irc.reply(self.__format_message(item, position + 1, total), prefixNick=False)
|
||||
find = wrap(find, ['anything', optional('int', default=1)])
|
||||
|
||||
Class = Metal
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue