mirror of
https://github.com/PaiGramTeam/PaiGram.git
synced 2024-11-16 04:35:49 +00:00
🎨 update avatar list split count style
This commit is contained in:
parent
124c7533d7
commit
e634711648
@ -506,6 +506,9 @@ class AbyssPlugin(Plugin):
|
|||||||
"""渲染层数数据"""
|
"""渲染层数数据"""
|
||||||
callback_query = update.callback_query
|
callback_query = update.callback_query
|
||||||
message = callback_query.message
|
message = callback_query.message
|
||||||
|
reply = None
|
||||||
|
if message.reply_to_message:
|
||||||
|
reply = message.reply_to_message
|
||||||
|
|
||||||
floor = 0
|
floor = 0
|
||||||
total = False
|
total = False
|
||||||
@ -534,7 +537,7 @@ class AbyssPlugin(Plugin):
|
|||||||
|
|
||||||
for group in ArkoWrapper(images).group(10): # 每 10 张图片分一个组
|
for group in ArkoWrapper(images).group(10): # 每 10 张图片分一个组
|
||||||
await RenderGroupResult(results=group).reply_media_group(
|
await RenderGroupResult(results=group).reply_media_group(
|
||||||
message, allow_sending_without_reply=True, write_timeout=60
|
reply or message, allow_sending_without_reply=True, write_timeout=60
|
||||||
)
|
)
|
||||||
self.log_user(update, logger.info, "[bold]深渊挑战数据[/bold]: 成功发送图片", extra={"markup": True})
|
self.log_user(update, logger.info, "[bold]深渊挑战数据[/bold]: 成功发送图片", extra={"markup": True})
|
||||||
self.add_delete_message_job(message, delay=1)
|
self.add_delete_message_job(message, delay=1)
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
import asyncio
|
import asyncio
|
||||||
|
import math
|
||||||
from typing import List, Optional, Sequence, TYPE_CHECKING, Union, Tuple, Any, Dict
|
from typing import List, Optional, Sequence, TYPE_CHECKING, Union, Tuple, Any, Dict
|
||||||
|
|
||||||
from arkowrapper import ArkoWrapper
|
from arkowrapper import ArkoWrapper
|
||||||
@ -160,10 +161,12 @@ class AvatarListPlugin(Plugin):
|
|||||||
|
|
||||||
if only_one_page:
|
if only_one_page:
|
||||||
return [await render_task(0, avatar_datas)]
|
return [await render_task(0, avatar_datas)]
|
||||||
avatar_datas_group = [
|
image_count = len(avatar_datas)
|
||||||
avatar_datas[i : i + MAX_AVATAR_COUNT] for i in range(0, len(avatar_datas), MAX_AVATAR_COUNT)
|
while image_count > MAX_AVATAR_COUNT:
|
||||||
]
|
image_count /= 2
|
||||||
tasks = [render_task(i * MAX_AVATAR_COUNT, c) for i, c in enumerate(avatar_datas_group)]
|
image_count = math.ceil(image_count)
|
||||||
|
avatar_datas_group = [avatar_datas[i : i + image_count] for i in range(0, len(avatar_datas), image_count)]
|
||||||
|
tasks = [render_task(i * image_count, c) for i, c in enumerate(avatar_datas_group)]
|
||||||
return await asyncio.gather(*tasks)
|
return await asyncio.gather(*tasks)
|
||||||
|
|
||||||
@handler.command("avatars", cookie=True, block=False)
|
@handler.command("avatars", cookie=True, block=False)
|
||||||
|
Loading…
Reference in New Issue
Block a user