fix filters
This commit is contained in:
parent
acb28b775a
commit
7ef6df69d2
10
main.py
10
main.py
@ -102,7 +102,7 @@ async def check_updates():
|
|||||||
logging.exception(e)
|
logging.exception(e)
|
||||||
|
|
||||||
|
|
||||||
@dp.message_handler(commands=['add'], filter=filters.IDFilter(chat_id=user_ids))
|
@dp.message_handler(filters.IDFilter(chat_id=user_ids), commands=['add'])
|
||||||
async def add_tag(msg: Message):
|
async def add_tag(msg: Message):
|
||||||
args = msg.get_args()
|
args = msg.get_args()
|
||||||
if not args:
|
if not args:
|
||||||
@ -113,7 +113,7 @@ async def add_tag(msg: Message):
|
|||||||
await msg.reply(f'Tags {args} added')
|
await msg.reply(f'Tags {args} added')
|
||||||
|
|
||||||
|
|
||||||
@dp.message_handler(regexp=r'^\/del_\S+$', filter=filters.IDFilter(chat_id=user_ids))
|
@dp.message_handler(filters.IDFilter(chat_id=user_ids), regexp=r'^\/del_\S+$')
|
||||||
async def del_tag(msg: Message):
|
async def del_tag(msg: Message):
|
||||||
args = msg.text[5:]
|
args = msg.text[5:]
|
||||||
if not args:
|
if not args:
|
||||||
@ -129,7 +129,7 @@ async def del_tag(msg: Message):
|
|||||||
await msg.reply(f'Tag {args} removed')
|
await msg.reply(f'Tag {args} removed')
|
||||||
|
|
||||||
|
|
||||||
@dp.message_handler(commands=['del'], filter=filters.IDFilter(chat_id=user_ids))
|
@dp.message_handler(filters.IDFilter(chat_id=user_ids), commands=['del'])
|
||||||
async def del_command(msg: Message):
|
async def del_command(msg: Message):
|
||||||
args = msg.get_args()
|
args = msg.get_args()
|
||||||
if not args:
|
if not args:
|
||||||
@ -140,7 +140,7 @@ async def del_command(msg: Message):
|
|||||||
await msg.reply(f'Tags {args} removed')
|
await msg.reply(f'Tags {args} removed')
|
||||||
|
|
||||||
|
|
||||||
@dp.message_handler(commands=['list'], filter=filters.IDFilter(chat_id=user_ids))
|
@dp.message_handler(filters.IDFilter(chat_id=user_ids), commands=['list'])
|
||||||
async def list_tags(msg: Message):
|
async def list_tags(msg: Message):
|
||||||
tags = [t.decode() for t in await redis.smembers('e621:subs')]
|
tags = [t.decode() for t in await redis.smembers('e621:subs')]
|
||||||
tags.sort()
|
tags.sort()
|
||||||
@ -158,7 +158,7 @@ async def list_tags(msg: Message):
|
|||||||
await msg.reply(f'Monitored tags:\n\n{lines}')
|
await msg.reply(f'Monitored tags:\n\n{lines}')
|
||||||
|
|
||||||
|
|
||||||
@dp.message_handler(commands=['update'], filter=filters.IDFilter(chat_id=user_ids))
|
@dp.message_handler(filters.IDFilter(chat_id=user_ids), commands=['update'])
|
||||||
async def update(msg: Message):
|
async def update(msg: Message):
|
||||||
await check_updates()
|
await check_updates()
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user