1
0
Fork 0
mirror of https://github.com/myned/modufur.git synced 2024-11-02 05:02:39 +00:00

Fixed url count

This commit is contained in:
Myned 2017-10-31 00:49:02 -04:00
parent 3388325aa5
commit 8d67775a7c

View file

@ -305,12 +305,13 @@ class MsG:
if not links: if not links:
raise exc.NotFound raise exc.NotFound
n = 1
for message, urls in links.items(): for message, urls in links.items():
for url in urls: for url in urls:
try: try:
await dest.trigger_typing() await dest.trigger_typing()
await dest.send('`{} / {}` **Probable match from** {}\n{}'.format(urls.index(url) + 1, len(urls), message.author.display_name, await scraper.get_post(url))) await dest.send('`{} / {}` **Probable match from** {}\n{}'.format(n, len(links), message.author.display_name, await scraper.get_post(url)))
await message.add_reaction('') await message.add_reaction('')
await asyncio.sleep(self.RATE_LIMIT) await asyncio.sleep(self.RATE_LIMIT)
@ -320,10 +321,13 @@ class MsG:
await message.delete() await message.delete()
except exc.MatchError as e: except exc.MatchError as e:
await ctx.send('**No probable match for:** `{}`'.format(e), delete_after=10) await ctx.send('`{} / {}` **No probable match for:** `{}`'.format(n, len(links), e), delete_after=10)
await message.add_reaction('') await message.add_reaction('')
c -= 1 c -= 1
finally:
n += 1
if c > 0: if c > 0:
await ctx.message.add_reaction('') await ctx.message.add_reaction('')
else: else:
@ -367,6 +371,7 @@ class MsG:
if not links: if not links:
raise exc.NotFound raise exc.NotFound
n = 1
for message, urls in links.items(): for message, urls in links.items():
for url in urls: for url in urls:
try: try:
@ -374,7 +379,7 @@ class MsG:
post = await scraper.get_post(url) post = await scraper.get_post(url)
await dest.send('`{} / {}` **Probable match from** {}\n{}'.format(urls.index(url) + 1, len(urls), message.author.display_name, await scraper.get_image(post))) await dest.send('`{} / {}` **Probable match from** {}\n{}'.format(n, len(links), message.author.display_name, await scraper.get_image(post)))
await message.add_reaction('') await message.add_reaction('')
await asyncio.sleep(self.RATE_LIMIT) await asyncio.sleep(self.RATE_LIMIT)
@ -384,10 +389,13 @@ class MsG:
await message.delete() await message.delete()
except exc.MatchError as e: except exc.MatchError as e:
await ctx.send('**No probable match for:** `{}`'.format(e), delete_after=10) await ctx.send('`{} / {}` **No probable match for:** `{}`'.format(n, len(links), e), delete_after=10)
await message.add_reaction('') await message.add_reaction('')
c -= 1 c -= 1
finally:
n += 1
if c > 0: if c > 0:
await ctx.message.add_reaction('') await ctx.message.add_reaction('')
else: else: