aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--bot/converters.py18
1 files changed, 7 insertions, 11 deletions
diff --git a/bot/converters.py b/bot/converters.py
index 3c8ea44d7..038f815a5 100644
--- a/bot/converters.py
+++ b/bot/converters.py
@@ -423,23 +423,19 @@ class HushDurationConverter(Converter):
def _is_an_unambiguous_user_argument(argument: str) -> bool:
- """Check if the provided argument is a user mention, user id, or username (name#discrim)."""
- has_id_or_mention = bool(IDConverter()._get_id_match(argument) or RE_USER_MENTION.match(argument))
+ """Check if the provided argument is a user mention or user id."""
+ user_id = IDConverter._get_id_match(argument)
+ user_mention = RE_USER_MENTION.match(argument)
- # Check to see if the author passed a username (a discriminator exists)
- argument = argument.removeprefix("@")
- has_username = len(argument) > 5 and argument[-5] == "#"
+ return bool(user_id or user_mention)
- return has_id_or_mention or has_username
-
-AMBIGUOUS_ARGUMENT_MSG = ("`{argument}` is not a User mention, a User ID or a Username in the format"
- " `name#discriminator`.")
+AMBIGUOUS_ARGUMENT_MSG = "`{argument}` is not a User mention or a User ID."
class UnambiguousUser(UserConverter):
"""
- Converts to a `discord.User`, but only if a mention, userID or a username (name#discrim) is provided.
+ Converts to a `discord.User`, but only if a mention or userID is provided.
Unlike the default `UserConverter`, it doesn't allow conversion from a name.
This is useful in cases where that lookup strategy would lead to too much ambiguity.
@@ -454,7 +450,7 @@ class UnambiguousUser(UserConverter):
class UnambiguousMember(MemberConverter):
"""
- Converts to a `discord.Member`, but only if a mention, userID or a username (name#discrim) is provided.
+ Converts to a `discord.Member`, but only if a mention or userID is provided.
Unlike the default `MemberConverter`, it doesn't allow conversion from a name or nickname.
This is useful in cases where that lookup strategy would lead to too much ambiguity.