aboutsummaryrefslogtreecommitdiffstats
path: root/bot/exts/utilities/challenges.py
diff options
context:
space:
mode:
authorGravatar Shom770 <[email protected]>2021-10-14 06:51:23 -0400
committerGravatar Shom770 <[email protected]>2021-10-14 06:51:23 -0400
commit3ff315f34721bca59b0820207da6bdd748155293 (patch)
tree190f6a41587e0878b4196b08cd58f486b8d07b1f /bot/exts/utilities/challenges.py
parentrequested changes from TizzySaurus implemented (diff)
removed repeating query is None
Diffstat (limited to 'bot/exts/utilities/challenges.py')
-rw-r--r--bot/exts/utilities/challenges.py31
1 files changed, 16 insertions, 15 deletions
diff --git a/bot/exts/utilities/challenges.py b/bot/exts/utilities/challenges.py
index d3ef82a0..e4738455 100644
--- a/bot/exts/utilities/challenges.py
+++ b/bot/exts/utilities/challenges.py
@@ -281,21 +281,22 @@ class Challenges(commands.Cog):
get_kata_link = f"https://codewars.com/kata/search/{language}"
params = {}
- if query is not None and "," in query:
- query_splitted = query.split("," if ", " not in query else ", ")
-
- if len(query_splitted) > 2:
- raise commands.BadArgument(
- "There can only be one comma within the query, separating the difficulty and the query itself."
- )
-
- query, level = query_splitted
- params["q"] = query
- params["r[]"] = f"-{level}"
- elif query is not None and query.isnumeric():
- params["r[]"] = f"-{query}"
- elif query is not None:
- params["q"] = query
+ if query is not None:
+ if "," in query:
+ query_splitted = query.split("," if ", " not in query else ", ")
+
+ if len(query_splitted) > 2:
+ raise commands.BadArgument(
+ "There can only be one comma within the query, separating the difficulty and the query itself."
+ )
+
+ query, level = query_splitted
+ params["q"] = query
+ params["r[]"] = f"-{level}"
+ elif query.isnumeric():
+ params["r[]"] = f"-{query}"
+ else:
+ params["q"] = query
params["beta"] = str(language in SUPPORTED_LANGUAGES["beta"]).lower()