From 3ff315f34721bca59b0820207da6bdd748155293 Mon Sep 17 00:00:00 2001 From: Shom770 <82843611+Shom770@users.noreply.github.com> Date: Thu, 14 Oct 2021 06:51:23 -0400 Subject: removed repeating query is None --- bot/exts/utilities/challenges.py | 31 ++++++++++++++++--------------- 1 file changed, 16 insertions(+), 15 deletions(-) (limited to 'bot/exts/utilities/challenges.py') 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() -- cgit v1.2.3