mirror of
https://github.com/Cog-Creators/Red-DiscordBot.git
synced 2025-11-22 18:57:59 -05:00
Make checks in Bank, Economy and Trivia cogs Permissions-friendly (#3672)
* Create converters.py * Update trivia.py * Create checks.py * Update checks.py * Update checks.py * Update trivia.py * Update checks.py * Update checks.py * Update trivia.py * Update bank.py * Update economy.py * Update trivia.py * Update checks.py * Update checks.py * Update __init__.py
This commit is contained in:
18
redbot/cogs/trivia/converters.py
Normal file
18
redbot/cogs/trivia/converters.py
Normal file
@@ -0,0 +1,18 @@
|
||||
import math
|
||||
|
||||
from redbot.core import commands
|
||||
from redbot.core.i18n import Translator
|
||||
|
||||
__all__ = ("finite_float",)
|
||||
|
||||
_ = Translator("Trivia", __file__)
|
||||
|
||||
|
||||
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
|
||||
Reference in New Issue
Block a user