diff options
| author | 2018-08-14 15:42:23 +0100 | |
|---|---|---|
| committer | 2018-09-09 16:41:52 +0200 | |
| commit | 5b7c84bb362b1923f42c56b34b29394708a6e475 (patch) | |
| tree | c269bf6ba4ff2d916e0fa291c303105a0a12f76f | |
| parent | [Snekbox] Show help when eval run without code (diff) | |
Patched off-topic system to allow alternative apostrophe character, and convert accordingly.
| -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): | 
