diff --git a/changelog.d/3004.bugfix.rst b/changelog.d/3004.bugfix.rst new file mode 100644 index 000000000..05e31452f --- /dev/null +++ b/changelog.d/3004.bugfix.rst @@ -0,0 +1 @@ +Fixed MessagePredicate.greater and MessagePredicate.less allowing any valid int instead of only valid ints/floats that are greater/less than the given value. diff --git a/redbot/core/utils/predicates.py b/redbot/core/utils/predicates.py index 5b311a55e..2b35c5051 100644 --- a/redbot/core/utils/predicates.py +++ b/redbot/core/utils/predicates.py @@ -574,7 +574,7 @@ class MessagePredicate(Callable[[discord.Message], bool]): """ valid_int = cls.valid_int(ctx, channel, user) valid_float = cls.valid_float(ctx, channel, user) - return cls(lambda self, m: valid_int(m) or valid_float(m) and float(m.content) < value) + return cls(lambda self, m: (valid_int(m) or valid_float(m)) and float(m.content) < value) @classmethod def greater( @@ -605,7 +605,7 @@ class MessagePredicate(Callable[[discord.Message], bool]): """ valid_int = cls.valid_int(ctx, channel, user) valid_float = cls.valid_float(ctx, channel, user) - return cls(lambda self, m: valid_int(m) or valid_float(m) and float(m.content) > value) + return cls(lambda self, m: (valid_int(m) or valid_float(m)) and float(m.content) > value) @classmethod def length_less(