mirror of
https://github.com/Cog-Creators/Red-DiscordBot.git
synced 2025-11-06 11:18:54 -05:00
22 lines
488 B
Python
22 lines
488 B
Python
import math
|
|
|
|
from redbot.core import commands
|
|
from redbot.core.i18n import Translator
|
|
|
|
__all__ = ("finite_float",)
|
|
|
|
_ = Translator("Trivia", __file__)
|
|
|
|
|
|
MAX_VALUE = 2**63 - 1
|
|
|
|
|
|
def finite_float(arg: str) -> float:
|
|
try:
|
|
ret = float(arg)
|
|
except ValueError:
|
|
raise commands.BadArgument(_("`{arg}` is not a number.").format(arg=arg))
|
|
if not math.isfinite(ret):
|
|
raise commands.BadArgument(_("`{arg}` is not a finite number.").format(arg=ret))
|
|
return ret
|