handle empty tags
This commit is contained in:
5
main.py
5
main.py
@@ -229,7 +229,10 @@ async def add_tag(msg: Message):
|
||||
return
|
||||
for tag in args.split():
|
||||
posts = await e621.get_posts(tag)
|
||||
await redis.sadd(REDIS_SENT_KEY, *[post.id for post in posts])
|
||||
if posts:
|
||||
await redis.sadd(REDIS_SENT_KEY, *[post.id for post in posts])
|
||||
else:
|
||||
logging.warning(f'No posts found for tag {tag}')
|
||||
await redis.sadd(REDIS_SUBS_KEY, tag)
|
||||
await msg.reply(f'Tags {args} added')
|
||||
|
||||
|
Reference in New Issue
Block a user