aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--bot/exts/backend/error_handler.py2
-rw-r--r--bot/exts/info/tags.py18
2 files changed, 10 insertions, 10 deletions
diff --git a/bot/exts/backend/error_handler.py b/bot/exts/backend/error_handler.py
index 78822aece..51b6bc660 100644
--- a/bot/exts/backend/error_handler.py
+++ b/bot/exts/backend/error_handler.py
@@ -155,7 +155,7 @@ class ErrorHandler(Cog):
return
try:
- tag_identifier = tags.extract_tag_identifier(ctx.message.content)
+ tag_identifier = tags.TagIdentifier.from_string(ctx.message.content)
if tag_identifier.group is not None:
tag_name = await TagNameConverter.convert(ctx, tag_identifier.name)
tag_name_or_group = await TagNameConverter.convert(ctx, tag_identifier.group)
diff --git a/bot/exts/info/tags.py b/bot/exts/info/tags.py
index f2b5c0823..c05528daf 100644
--- a/bot/exts/info/tags.py
+++ b/bot/exts/info/tags.py
@@ -68,6 +68,15 @@ class TagIdentifier(NamedTuple):
else:
return self.name
+ @classmethod
+ def from_string(cls, string: str) -> TagIdentifier:
+ """Create a `TagIdentifier` instance from the beginning of `string`."""
+ split_string = string.removeprefix(constants.Bot.prefix).split(" ", maxsplit=2)
+ if len(split_string) == 1:
+ return cls(None, split_string[0])
+ else:
+ return cls(split_string[0], split_string[1])
+
class Tag:
"""Provide an interface to a tag from resources with `file_content`."""
@@ -404,12 +413,3 @@ class Tags(Cog):
def setup(bot: Bot) -> None:
"""Load the Tags cog."""
bot.add_cog(Tags(bot))
-
-
-def extract_tag_identifier(string: str) -> TagIdentifier:
- """Create a `TagIdentifier` instance from the beginning of `string`."""
- split_string = string.removeprefix(constants.Bot.prefix).split(" ", maxsplit=2)
- if len(split_string) == 1:
- return TagIdentifier(None, split_string[0])
- else:
- return TagIdentifier(split_string[0], split_string[1])