From 51e0e3d016ed1c39bb2dd80cc84ee5ec2c29e0aa Mon Sep 17 00:00:00 2001 From: bakatrouble Date: Mon, 10 Apr 2023 03:58:54 +0300 Subject: [PATCH] add bulk del command --- main.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/main.py b/main.py index 3d491a0..512a69b 100644 --- a/main.py +++ b/main.py @@ -126,6 +126,17 @@ async def del_tag(msg: Message): await msg.reply(f'Tag {args} removed') +@dp.message_handler(commands=['del']) +async def del_command(msg: Message): + args = msg.get_args() + if not args: + await msg.reply('Please provide tag to subscribe to') + return + for tag in args.split(): + await redis.srem('e621:subs', tag) + await msg.reply(f'Tags {args} removed') + + @dp.message_handler(commands=['list']) async def list_tags(msg: Message): tags = [t.decode() for t in await redis.smembers('e621:subs')]