add bulk del command

This commit is contained in:
bakatrouble 2023-04-10 03:58:54 +03:00
parent 5554783d79
commit 51e0e3d016

11
main.py
View File

@ -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')]