mirror of
https://github.com/zhenxun-org/zhenxun_bot.git
synced 2026-09-28 16:20:56 +08:00
@@ -3,9 +3,11 @@ from nonebot_plugin_session import EventSession
|
||||
from nonebot_plugin_apscheduler import scheduler
|
||||
from nonebot_plugin_alconna import (
|
||||
Args,
|
||||
Query,
|
||||
Option,
|
||||
Alconna,
|
||||
Arparma,
|
||||
AlconnaQuery,
|
||||
on_alconna,
|
||||
store_true,
|
||||
)
|
||||
@@ -90,7 +92,7 @@ _sign_matcher = on_alconna(
|
||||
Option("--my", action=store_true, help_text="我的签到"),
|
||||
Option(
|
||||
"-l|--list",
|
||||
Args["num", int, 10],
|
||||
Args["num", int],
|
||||
help_text="好感度排行",
|
||||
),
|
||||
Option("-g|--global", action=store_true, help_text="全局排行"),
|
||||
@@ -140,7 +142,11 @@ async def _(session: EventSession, arparma: Arparma, nickname: str = UserName())
|
||||
|
||||
|
||||
@_sign_matcher.assign("list")
|
||||
async def _(session: EventSession, arparma: Arparma, num: int):
|
||||
async def _(
|
||||
session: EventSession, arparma: Arparma, num: Query[int] = AlconnaQuery("num", 10)
|
||||
):
|
||||
if num.result > 50:
|
||||
await MessageUtils.build_message("排行榜人数不能超过50哦...").finish()
|
||||
gid = session.id3 or session.id2
|
||||
if not arparma.find("global") and not gid:
|
||||
await MessageUtils.build_message(
|
||||
@@ -149,7 +155,7 @@ async def _(session: EventSession, arparma: Arparma, num: int):
|
||||
if session.id1:
|
||||
if arparma.find("global"):
|
||||
gid = None
|
||||
if image := await SignManage.rank(session.id1, num, gid):
|
||||
if image := await SignManage.rank(session.id1, num.result, gid):
|
||||
logger.info("查看签到排行", arparma.header_result, session=session)
|
||||
await MessageUtils.build_message(image).finish()
|
||||
return MessageUtils.build_message("用户id为空...").send()
|
||||
|
||||
Reference in New Issue
Block a user