diff options
author | 2022-09-30 22:32:16 +0300 | |
---|---|---|
committer | 2022-09-30 22:32:16 +0300 | |
commit | dbb078bd4d5d4d558138004b2d4b639b02c8106b (patch) | |
tree | 7a7c0883f94b1aca1fde43e83ca953a47ee73cc5 | |
parent | Add filter edit command (diff) |
Add filter delete command
-rw-r--r-- | bot/exts/filtering/filtering.py | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/bot/exts/filtering/filtering.py b/bot/exts/filtering/filtering.py index 8ff26795e..1beb23ced 100644 --- a/bot/exts/filtering/filtering.py +++ b/bot/exts/filtering/filtering.py @@ -415,6 +415,18 @@ class Filtering(Cog): ) await ctx.send(embed=embed, reference=ctx.message, view=view) + @filter.command(name="delete", aliases=("d", "remove")) + async def f_delete(self, ctx: Context, filter_id: int) -> None: + """Delete the filter specified by its ID.""" + result = self._get_filter_by_id(filter_id) + if result is None: + await ctx.send(f":x: Could not find a filter with ID `{filter_id}`.") + return + filter_, filter_list, list_type = result + await bot.instance.api_client.delete(f'bot/filter/filters/{filter_id}') + filter_list.filter_lists[list_type].pop(filter_id) + await ctx.reply(f"✅ Deleted filter: {filter_}") + @filter.group(aliases=("settings",)) async def setting(self, ctx: Context) -> None: """Group for settings-related commands.""" |