From 1920212eda3b67b682e2e1728cc3afdb0ce481fd Mon Sep 17 00:00:00 2001 From: Neuro Assassin <42872277+NeuroAssassin@users.noreply.github.com> Date: Thu, 11 Feb 2021 16:30:16 -0500 Subject: [PATCH] [Cleanup] Fix error when providing message snowflake above the maximum (9223372036854775807) (#4791) * [Cleanup] Fix angry error * haha just kidding, does not work * change to be clearer * update to module level * cmon black * added in wrong place --- redbot/cogs/cleanup/converters.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/redbot/cogs/cleanup/converters.py b/redbot/cogs/cleanup/converters.py index bbd2e4ffc..3b685eaa9 100644 --- a/redbot/cogs/cleanup/converters.py +++ b/redbot/cogs/cleanup/converters.py @@ -6,10 +6,12 @@ from redbot.core.utils.chat_formatting import inline _ = Translator("Cleanup", __file__) +SNOWFLAKE_THRESHOLD = 2 ** 63 + class RawMessageIds(Converter): async def convert(self, ctx: Context, argument: str) -> int: - if argument.isnumeric() and len(argument) >= 17: + if argument.isnumeric() and len(argument) >= 17 and int(argument) < SNOWFLAKE_THRESHOLD: return int(argument) raise BadArgument(_("{} doesn't look like a valid message ID.").format(argument))