Image number selection design fix.
This commit is contained in:
parent
952c47f2ea
commit
dc3a45297b
|
@ -55,8 +55,7 @@ class BotInstance:
|
|||
def get_random_image(self, max_page_number = 100):
|
||||
# Get a random page number
|
||||
page_number = random.randint(0, max_page_number)
|
||||
# Get a random image from the page
|
||||
image_number = random.randint(0, 100)
|
||||
|
||||
# Get the JSON data from the API
|
||||
if self.gelbooru_tags_exclude != "":
|
||||
gelbooru_tags_exclude = " " + self.gelbooru_tags_exclude
|
||||
|
@ -70,8 +69,8 @@ class BotInstance:
|
|||
# Make sure there are images on the page
|
||||
if 'post' not in gelbooru_json:
|
||||
return None, None, None, max_pages
|
||||
# Make sure the image number is valid
|
||||
if image_number > len(gelbooru_json['post']):
|
||||
|
||||
# Choose a random image from the page
|
||||
image_number = random.randint(0, len(gelbooru_json['post']))
|
||||
|
||||
# Save json to file for debugging
|
||||
|
|
Loading…
Reference in New Issue