diff options
author | 2019-06-23 20:30:45 +0100 | |
---|---|---|
committer | 2019-06-23 20:30:45 +0100 | |
commit | bb93bfe9d7d043d69f31e4d0b49658c0c8e4b2ea (patch) | |
tree | d5d1d0099db1b9ae285ed41491a23592789c6f9b | |
parent | Anti-spam should use the same whitelist as Filters (diff) | |
parent | Merge branch 'master' into off-topic-convert (diff) |
Merge pull request #373 from python-discord/off-topic-convert
Accept uppercase and punctuation for off-topic names
-rw-r--r-- | bot/cogs/off_topic_names.py | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/bot/cogs/off_topic_names.py b/bot/cogs/off_topic_names.py index 2cdaa2c4f..8fbddde4e 100644 --- a/bot/cogs/off_topic_names.py +++ b/bot/cogs/off_topic_names.py @@ -19,7 +19,7 @@ class OffTopicName(Converter): @staticmethod async def convert(ctx: Context, argument: str): - allowed_characters = ("-", "โ", "'", "`") + allowed_characters = "ABCDEFGHIJKLMNOPQRSTUVWXYZ!?'`" if not (2 <= len(argument) <= 96): raise BadArgument("Channel name must be between 2 and 96 chars long") @@ -30,11 +30,11 @@ class OffTopicName(Converter): "alphanumeric characters, minus signs or apostrophes." ) - elif not argument.islower(): - raise BadArgument("Channel name must be lowercase") - - # Replace some unusable apostrophe-like characters with "โ". - return argument.replace("'", "โ").replace("`", "โ") + # Replace invalid characters with unicode alternatives. + table = str.maketrans( + allowed_characters, '๐ ๐ก๐ข๐ฃ๐ค๐ฅ๐ฆ๐ง๐จ๐ฉ๐ช๐ซ๐ฌ๐ญ๐ฎ๐ฏ๐ฐ๐ฑ๐ฒ๐ณ๐ด๐ต๐ถ๐ท๐ธ๐นว๏ผโโ' + ) + return argument.translate(table) async def update_names(bot: Bot, headers: dict): |