mirror of
https://github.com/ChenXu233/nonebot_plugin_dialectlist.git
synced 2025-02-08 03:46:21 +08:00
✨ 私聊查询消息榜
This commit is contained in:
parent
6ba8ce9922
commit
5eb207fe16
@ -41,8 +41,6 @@ from nonebot_plugin_alconna import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
from nonebot_plugin_chatrecorder import get_message_records
|
from nonebot_plugin_chatrecorder import get_message_records
|
||||||
from nonebot_plugin_localstore import get_cache_file
|
|
||||||
from nonebot_plugin_htmlrender import html_to_pic
|
|
||||||
from nonebot_plugin_userinfo import get_user_info
|
from nonebot_plugin_userinfo import get_user_info
|
||||||
from nonebot_plugin_session import Session, SessionIdType, extract_session
|
from nonebot_plugin_session import Session, SessionIdType, extract_session
|
||||||
|
|
||||||
@ -61,6 +59,7 @@ from .utils import (
|
|||||||
msg_counter,
|
msg_counter,
|
||||||
persist_id2user_id,
|
persist_id2user_id,
|
||||||
user_id2persist_id,
|
user_id2persist_id,
|
||||||
|
group_id2persist_id,
|
||||||
get_rank_image,
|
get_rank_image,
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -221,10 +220,9 @@ async def handle_rank(
|
|||||||
session: Session = Depends(extract_session),
|
session: Session = Depends(extract_session),
|
||||||
start: datetime = Arg(),
|
start: datetime = Arg(),
|
||||||
stop: datetime = Arg(),
|
stop: datetime = Arg(),
|
||||||
# group_id: str = Arg(),
|
|
||||||
):
|
):
|
||||||
if id := state["group_id"]:
|
if id := state["group_id"]:
|
||||||
# id = await user_id2persist_id(id)
|
id = str(id)
|
||||||
logger.debug(f"group_id: {id}")
|
logger.debug(f"group_id: {id}")
|
||||||
else:
|
else:
|
||||||
id = session.id2
|
id = session.id2
|
||||||
|
@ -67,15 +67,12 @@ async def user_id2persist_id(ids: List[str]) -> List[int]:
|
|||||||
|
|
||||||
|
|
||||||
async def group_id2persist_id(ids: List[str]) -> List[int]:
|
async def group_id2persist_id(ids: List[str]) -> List[int]:
|
||||||
whereclause: List[ColumnElement[bool]] = []
|
persist_ids = []
|
||||||
whereclause.append(or_(*[SessionModel.id2 == id for id in ids]))
|
|
||||||
statement = (
|
|
||||||
select(SessionModel).where(*whereclause)
|
|
||||||
# .join(SessionModel, SessionModel.id == MessageRecord.session_persist_id)
|
|
||||||
)
|
|
||||||
async with get_session() as db_session:
|
async with get_session() as db_session:
|
||||||
records = (await db_session.scalars(statement)).all()
|
for i in ids:
|
||||||
return [i.id for i in records]
|
persist_id = (await db_session.scalar(select(SessionModel).where(or_(*[SessionModel.id2 == i])))).id # type: ignore
|
||||||
|
persist_ids.append(persist_id)
|
||||||
|
return persist_ids
|
||||||
|
|
||||||
|
|
||||||
async def persist_id2group_id(ids: List[str]) -> List[str]:
|
async def persist_id2group_id(ids: List[str]) -> List[str]:
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
[project]
|
[project]
|
||||||
name = "nonebot-plugin-dialectlist"
|
name = "nonebot-plugin-dialectlist"
|
||||||
version = "2.1.9"
|
version = "2.2.0"
|
||||||
description = "看看你群群友有多能说"
|
description = "看看你群群友有多能说"
|
||||||
authors = [
|
authors = [
|
||||||
{name = "Chen_Xu233", email = "woyerpa@outlook.com"},
|
{name = "Chen_Xu233", email = "woyerpa@outlook.com"},
|
||||||
|
Loading…
x
Reference in New Issue
Block a user