diff options
-rw-r--r-- | bot/cogs/off_topic_names.py | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/bot/cogs/off_topic_names.py b/bot/cogs/off_topic_names.py index bcf3148f8..bf68c9013 100644 --- a/bot/cogs/off_topic_names.py +++ b/bot/cogs/off_topic_names.py @@ -19,19 +19,22 @@ class OffTopicName(Converter): @staticmethod async def convert(ctx: Context, argument: str): + allowed_characters = ("-", "’", "'", "`") + if not (2 <= len(argument) <= 96): raise BadArgument("Channel name must be between 2 and 96 chars long") - elif not all(c.isalnum() or c == '-' for c in argument): + elif not all(c.isalnum() or c in allowed_characters for c in argument): raise BadArgument( - "Channel name must only consist of" - " alphanumeric characters or minus signs" + "Channel name must only consist of " + "alphanumeric characters, minus signs or apostrophes." ) elif not argument.islower(): raise BadArgument("Channel name must be lowercase") - - return argument + + # Replace some unusable apostrophe-like characters with "’". + return argument.replace("'", "’").replace("`", "’") async def update_names(bot: Bot, headers: dict): |