aboutsummaryrefslogtreecommitdiffstats
path: root/bot/utils
diff options
context:
space:
mode:
authorGravatar ToxicKidz <[email protected]>2021-05-09 17:49:53 -0400
committerGravatar ToxicKidz <[email protected]>2021-05-09 17:49:53 -0400
commit4503a3307b989b251826f36e9370bda7471640b3 (patch)
tree036f31a4b8d68a3dcc8697a76eeb81aa86c3fd3b /bot/utils
parentchore: Simplify the if statement (diff)
fix: Use str.isdecimal instead of str.isdigit
Diffstat (limited to 'bot/utils')
-rw-r--r--bot/utils/__init__.py4
-rw-r--r--bot/utils/converters.py4
2 files changed, 4 insertions, 4 deletions
diff --git a/bot/utils/__init__.py b/bot/utils/__init__.py
index 2fac2086..09a4dfc3 100644
--- a/bot/utils/__init__.py
+++ b/bot/utils/__init__.py
@@ -51,7 +51,7 @@ async def disambiguate(
choices = (f"{index}: {entry}" for index, entry in enumerate(entries, start=1))
def check(message: discord.Message) -> bool:
- return (message.content.isdigit()
+ return (message.content.isdecimal()
and message.author == ctx.author
and message.channel == ctx.channel)
@@ -87,7 +87,7 @@ async def disambiguate(
except asyncio.TimeoutError:
raise BadArgument("Timed out.")
- # Guaranteed to not error because of isdigit() in check
+ # Guaranteed to not error because of isdecimal() in check
index = int(result.content)
try:
diff --git a/bot/utils/converters.py b/bot/utils/converters.py
index 98607087..72b64848 100644
--- a/bot/utils/converters.py
+++ b/bot/utils/converters.py
@@ -37,7 +37,7 @@ class CoordinateConverter(commands.Converter):
digit = coordinate[:-1]
letter = coordinate[-1]
- if not digit.isdigit():
+ if not digit.isdecimal():
raise commands.BadArgument
x = ord(letter) - ord("a")
@@ -76,7 +76,7 @@ class DateConverter(commands.Converter):
@staticmethod
async def convert(ctx: commands.Context, argument: str) -> Union[int, datetime]:
"""Parse date (SOL or earth) into `datetime` or `int`. When invalid value, raise error."""
- if argument.isdigit():
+ if argument.isdecimal():
return int(argument)
try:
date = datetime.strptime(argument, "%Y-%m-%d")