From 5df1703fb2075a36bbf3c2d5ee7c2e25713af00c Mon Sep 17 00:00:00 2001 From: Myned Date: Mon, 30 Oct 2017 15:44:41 -0400 Subject: [PATCH] Added ability to change order tag --- src/main/cogs/booru.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/main/cogs/booru.py b/src/main/cogs/booru.py index f7e6893..6aaa6b4 100644 --- a/src/main/cogs/booru.py +++ b/src/main/cogs/booru.py @@ -557,6 +557,11 @@ class MsG: raise exc.TagBlacklisted(tag) # Checks for blacklisted tags in endpoint blacklists - try/except is for continuing the parent loop + order = False + for tag in tags: + if 'order:' in tag: + order = True + tags = ','.join(['order:random'] + tags) if not order else ','.join(tags) posts = {} temposts = len(posts) empty = 0 @@ -564,7 +569,7 @@ class MsG: while len(posts) < limit: if c == limit * 5 + self.LIMIT: raise exc.Timeout - request = await u.fetch('https://{}.net/post/index.json'.format(booru), params={'tags': ','.join(['order:random'] + tags), 'limit': int(self.LIMIT * limit)}, json=True) + request = await u.fetch('https://{}.net/post/index.json'.format(booru), params={'tags': tags, 'limit': int(self.LIMIT * limit)}, json=True) if len(request) == 0: raise exc.NotFound(formatter.tostring(tags)) if len(request) < limit: