🎨 添加作物收获次数表及增删查改,用户可查询作物收获次数

This commit is contained in:
Mualamx
2025-10-23 02:05:04 +08:00
parent 2f0023d468
commit 15c482f41f
5 changed files with 261 additions and 0 deletions
+48
View File
@@ -98,6 +98,7 @@ diuse_farm = on_alconna(
Subcommand("my-vipPoint", help_text="我的点券"),
Subcommand("farm-help", help_text="农场帮助"),
Subcommand("vipSeed-shop", Args["res?", MultiVar(str)], help_text="种子商店"),
Subcommand("my-plantcount", help_text="我的作物收获次数"),
),
priority=5,
block=True,
@@ -776,3 +777,50 @@ async def _(session: Uninfo, res: Match[tuple[str, ...]]):
image = await g_pShopManager.getSeedShopImage(filterKey, page, 1)
await MessageUtils.build_message(image).send()
diuse_farm.shortcut(
"我的收获次数",
command="我的农场",
arguments=["my-plantcount"],
prefix=True,
)
@diuse_farm.assign("my-plantcount")
async def _(session: Uninfo, res: Match[tuple[str, ...]]):
uid = str(session.user.id)
player = await g_pToolManager.getPlayerByUid(uid)
if player is None or not await player.isRegistered():
await g_pToolManager.repeat()
return
if res.result is inspect._empty:
raw = []
else:
raw = res.result
filterKey: str | int | None = None
page: int = 1
if len(raw) >= 1 and raw[0] is not None:
first = raw[0]
if isinstance(first, str) and first.isdigit():
page = int(first)
else:
filterKey = first
if (
len(raw) >= 2
and raw[1] is not None
and isinstance(raw[1], str)
and raw[1].isdigit()
):
page = int(raw[1])
if filterKey is None:
image = await g_pFarmManager.getUserPlantCountImage(uid, page, 0)
else:
image = await g_pFarmManager.getUserPlantCountImage(uid, filterKey, page)
await MessageUtils.build_message(image).send()