aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar ToxicKidz <[email protected]>2021-05-07 11:01:24 -0400
committerGravatar ToxicKidz <[email protected]>2021-05-07 11:01:24 -0400
commit40d5a00f1b609b23a6cd77a3b7f1e4814ed7df82 (patch)
treeb8cdde833f24455c0c005301bd0cad90e524e59d
parentchore: Check if the number of squares first is bigger than the max first (diff)
chore: Get the next perfect square
If the amount of squares is not a perfect square, get the next highest perfect square
-rw-r--r--bot/exts/evergreen/avatar_modification/avatar_modify.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/bot/exts/evergreen/avatar_modification/avatar_modify.py b/bot/exts/evergreen/avatar_modification/avatar_modify.py
index dffe43ce..6418eaee 100644
--- a/bot/exts/evergreen/avatar_modification/avatar_modify.py
+++ b/bot/exts/evergreen/avatar_modification/avatar_modify.py
@@ -325,8 +325,10 @@ class AvatarModify(commands.Cog):
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("The number of squares must be a perfect square.")
+ sqrt = math.sqrt(squares)
+
+ if not sqrt.is_integer():
+ squares = math.ceil(sqrt) ** 2 # Get the next perfect square
file_name = file_safe_name("mosaic_avatar", ctx.author.display_name)