|
|
|
@ -38,6 +38,8 @@ dp = Dispatcher()
|
|
|
|
|
|
|
|
|
|
ChatFilter = F.chat.id.in_(set(map(int, os.environ['USERS'].split(','))))
|
|
|
|
|
|
|
|
|
|
PAGE_SIZE = 20
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def format_tags(tags: Iterable[str]):
|
|
|
|
|
return ' '.join(f'#{re.sub(r"[^0-9a-zA-Z_]", "_", tag)}' for tag in tags) or 'None'
|
|
|
|
@ -133,8 +135,8 @@ async def check_updates():
|
|
|
|
|
logging.warning('Lock acquired...')
|
|
|
|
|
tag_list = [t.decode() for t in await redis.smembers('e621:subs')]
|
|
|
|
|
random.shuffle(tag_list)
|
|
|
|
|
for tl_idx in range(0, len(tag_list), 40):
|
|
|
|
|
tags = ' '.join(f'~{tag}' for tag in tag_list[tl_idx: tl_idx + 40])
|
|
|
|
|
for tl_idx in range(0, len(tag_list), PAGE_SIZE):
|
|
|
|
|
tags = ' '.join(f'~{tag}' for tag in tag_list[tl_idx: tl_idx + PAGE_SIZE])
|
|
|
|
|
logging.warning(tags)
|
|
|
|
|
posts = await e621.get_posts(tags)
|
|
|
|
|
if not posts:
|
|
|
|
|