From f96b5270c90fee0c578b1cc898da4def0ffdee6d Mon Sep 17 00:00:00 2001 From: Myned Date: Sat, 21 Oct 2017 16:44:05 -0400 Subject: [PATCH] Added redundant check for image position input (> 0) --- src/main/cogs/booru.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/main/cogs/booru.py b/src/main/cogs/booru.py index 0ae2cf2..3a58e0e 100644 --- a/src/main/cogs/booru.py +++ b/src/main/cogs/booru.py @@ -530,7 +530,7 @@ class MsG: def on_message(msg): if msg.content.isdigit(): - if int(msg.content) <= len(posts) and msg.author is ctx.author and msg.channel is ctx.channel: + if 1 <= int(msg.content) <= len(posts) and msg.author is ctx.author and msg.channel is ctx.channel: return True return False @@ -692,9 +692,9 @@ class MsG: posts[post['id']] = {'author': post['author'], 'url': post['file_url']} if len(posts) == limit: break - c += 1 + c += 1 - return posts + return posts @commands.command(name='e621p', aliases=['e6p', '6p']) @checks.del_ctx() @@ -715,7 +715,7 @@ class MsG: def on_message(msg): if msg.content.isdigit(): - if int(msg.content) <= len(posts) and msg.author is ctx.author and msg.channel is ctx.channel: + if 1 <= int(msg.content) <= len(posts) and msg.author is ctx.author and msg.channel is ctx.channel: return True return False