diff options
Diffstat (limited to 'bot/exts/utilities/challenges.py')
-rw-r--r-- | bot/exts/utilities/challenges.py | 31 |
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() |