From 16b43597050b8dad922c8d93aa07c061e0512c1f Mon Sep 17 00:00:00 2001 From: ToxicKidz <78174417+ToxicKidz@users.noreply.github.com> Date: Thu, 6 May 2021 13:05:37 -0400 Subject: chore: Check if the number of squares first is bigger than the max first Co-authored-by: Anand Krishna <40204976+anand2312@users.noreply.github.com> --- bot/exts/evergreen/avatar_modification/avatar_modify.py | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/bot/exts/evergreen/avatar_modification/avatar_modify.py b/bot/exts/evergreen/avatar_modification/avatar_modify.py index 221bd809..dffe43ce 100644 --- a/bot/exts/evergreen/avatar_modification/avatar_modify.py +++ b/bot/exts/evergreen/avatar_modification/avatar_modify.py @@ -322,14 +322,11 @@ class AvatarModify(commands.Cog): await ctx.send(f"{Emojis.cross_mark} Could not get member info.") return - if squares < 1: - raise commands.BadArgument("Squares must be a positive number") + if 1 <= squares <= MAX_SQUARES: + raise commands.BadArgument(f"Squares must be a positive number less than or equal to {MAX_SQUARES:,}.") if not math.sqrt(squares).is_integer(): - raise commands.BadArgument("Squares must be a perfect square") - - if squares > MAX_SQUARES: - raise commands.BadArgument(f"Number of squares cannot be higher than {MAX_SQUARES:,}.") + raise commands.BadArgument("The number of squares must be a perfect square.") file_name = file_safe_name("mosaic_avatar", ctx.author.display_name) -- cgit v1.2.3