Fixes the logic of MessagePredicate.greater and MessagePredicate.less (#3004)

* Fixes the logic of MessagePredicate.greater and MessagePredicate.less

* Create 3004.bugfix.rst
This commit is contained in:
Flame442 2019-09-18 17:15:24 -04:00 committed by Michael H
parent 4546ca9ba6
commit 7f22d27d51
2 changed files with 3 additions and 2 deletions

View File

@ -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.

View File

@ -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(