diff options
| author | 2020-07-29 21:54:27 +0200 | |
|---|---|---|
| committer | 2020-07-29 21:54:27 +0200 | |
| commit | 4d1099938f4582330ce6c732dac4862df6ec68e4 (patch) | |
| tree | 81f91ac735c4246cc72d8f96f2ca21a8f217ccd9 | |
| parent | Apply suggested change from @MarkKoz. (diff) | |
Make sure file formats have leading dots.
| -rw-r--r-- | bot/cogs/filter_lists.py | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/bot/cogs/filter_lists.py b/bot/cogs/filter_lists.py index f133d53d9..8831a2143 100644 --- a/bot/cogs/filter_lists.py +++ b/bot/cogs/filter_lists.py @@ -43,6 +43,10 @@ class FilterLists(Cog): if not comment: comment = guild_data.get("name") + # If it's a file format, let's make sure it has a leading dot. + elif list_type == "FILE_FORMAT" and not content.startswith("."): + content = f".{content}" + # Try to add the item to the database log.trace(f"Trying to add the {content} item to the {list_type} {allow_type}") payload = { @@ -86,6 +90,10 @@ class FilterLists(Cog): guild_data = await self._validate_guild_invite(ctx, content) content = guild_data.get("id") + # If it's a file format, let's make sure it has a leading dot. + elif list_type == "FILE_FORMAT" and not content.startswith("."): + content = f".{content}" + # Find the content and delete it. log.trace(f"Trying to delete the {content} item from the {list_type} {allow_type}") item = self.bot.filter_list_cache[f"{list_type}.{allowed}"].get(content) |