合并转发开关!

This commit is contained in:
XuChenXu 2024-11-24 19:39:07 +08:00
parent 4e339bcdb1
commit 53b2a33923
2 changed files with 15 additions and 5 deletions

View File

@ -85,6 +85,12 @@ async def _build_cache(bot: Bot, event: Event):
await saa.Text("重建缓存完成。").send(reply=True)
b_cmd = on_alconna(
Alconna(
"看看他的B话",
)
)
rank_cmd = on_alconna(
Alconna(
"B话榜",
@ -267,7 +273,7 @@ async def handle_rank(
t1 = t.time()
rank2 = await get_user_infos(bot, event, rank)
logger.debug(f"获取用户信息花费时间:{t.time() - t1}")
string: str = ""
if plugin_config.show_text_rank:
@ -275,7 +281,7 @@ async def handle_rank(
string += f"关于{keyword}的话痨榜结果:\n"
else:
string += "话痨榜:\n"
for i in rank2:
logger.debug(i.user_name)
for i in range(len(rank2)):
@ -300,5 +306,8 @@ async def handle_rank(
msg += suffix
if not msg:
await saa.Text("你把可视化都关了哪来的排行榜?").finish()
await msg.finish(reply=True)
if plugin_config.aggregate_transmission:
await saa.AggregatedMessageFactory([msg]).finish(reply=True)
else:
await msg.finish(reply=True)

View File

@ -9,10 +9,11 @@ class ScopedConfig(BaseModel):
suffix: bool = True # 是否显示后缀
excluded_self: bool = True # 是否排除自己
visualization: bool = True # 是否可视化
show_text_rank:bool = True # 是否显示文本排名
show_text_rank: bool = True # 是否显示文本排名
counting_cache: bool = False # 计数缓存(能够提高回复速度)
excluded_people: List[str] = [] # 排除的人的QQ号
use_user_info_cache: bool = False # 是否使用用户信息缓存
aggregate_transmission:bool = False # 是否聚合转发消息
timezone: Optional[str] = "Asia/Shanghai" # 时区,影响统计时间
string_suffix: str = "统计花费时间:{timecost}" # 消息格式后缀
template_path: str = "./template/rank_template.j2" # 模板路径