mirror of
https://github.com/Shu-Ying/main_plugin_farm.git
synced 2026-10-30 14:20:01 +08:00
🎨 使用Python包管理和模块访问
🎨 重构数据库结构, 使用集中式服务定位器与数据库交互 🎨 更改部分代码逻辑, 减小内存消耗
This commit is contained in:
+118
-116
@@ -24,12 +24,8 @@ from zhenxun.services.log import logger
|
||||
from zhenxun.utils._build_image import BuildImage
|
||||
from zhenxun.utils.message import MessageUtils
|
||||
|
||||
from .core.activity.sign_in import g_pSignInManager
|
||||
from .core.dbService import g_pDBService
|
||||
from .core.farm import g_pFarmManager
|
||||
from .core.shop import g_pShopManager
|
||||
from .utils.config import g_bSignStatus, g_sTranslation
|
||||
from .utils.tool import g_pToolManager
|
||||
from .core import CShopManager, g_pDBlocator, getFarmManager, getSignInManager
|
||||
from .utils import config, getDrawFarm, getToolManager
|
||||
|
||||
diuse_register = on_alconna(
|
||||
Alconna("开通农场"),
|
||||
@@ -43,30 +39,30 @@ diuse_register = on_alconna(
|
||||
@diuse_register.handle()
|
||||
async def handle_register(session: Uninfo):
|
||||
uid = str(session.user.id)
|
||||
player = await g_pToolManager.getPlayerByUid(uid)
|
||||
player = await getToolManager().getPlayerByUid(uid)
|
||||
if player is not None and await player.isRegistered():
|
||||
await MessageUtils.build_message(g_sTranslation["register"]["repeat"]).send(
|
||||
reply_to=True
|
||||
)
|
||||
await MessageUtils.build_message(
|
||||
config.g_sTranslation["register"]["repeat"]
|
||||
).send(reply_to=True)
|
||||
return
|
||||
|
||||
try:
|
||||
raw_name = str(session.user.name)
|
||||
safe_name = g_pToolManager.sanitize_username(raw_name)
|
||||
safe_name = getToolManager().sanitize_username(raw_name)
|
||||
|
||||
success = await g_pDBService.user.initUserInfo(uid, safe_name)
|
||||
success = await g_pDBlocator.getUserManager().initUserInfo(uid, safe_name)
|
||||
|
||||
logger.info(f"用户 {uid} 选择的农场名称为: {raw_name} | 过滤后为: {safe_name}")
|
||||
|
||||
msg = (
|
||||
g_sTranslation["register"]["success"].format(point=500)
|
||||
config.g_sTranslation["register"]["success"].format(point=500)
|
||||
if success
|
||||
else g_sTranslation["register"]["error"]
|
||||
else config.g_sTranslation["register"]["error"]
|
||||
)
|
||||
logger.info(f"用户注册 {'成功' if success else '失败'}:{uid}")
|
||||
|
||||
except Exception as e:
|
||||
msg = g_sTranslation["register"]["error"]
|
||||
msg = config.g_sTranslation["register"]["error"]
|
||||
logger.error(f"注册异常 | UID:{uid} | 错误:{e}")
|
||||
|
||||
await MessageUtils.build_message(msg).send(reply_to=True)
|
||||
@@ -108,12 +104,12 @@ diuse_farm = on_alconna(
|
||||
@diuse_farm.assign("$main")
|
||||
async def _(session: Uninfo):
|
||||
uid = str(session.user.id)
|
||||
player = await g_pToolManager.getPlayerByUid(uid)
|
||||
player = await getToolManager().getPlayerByUid(uid)
|
||||
if player is None or not await player.isRegistered():
|
||||
await g_pToolManager.repeat()
|
||||
await getToolManager().repeat()
|
||||
return
|
||||
|
||||
image = await g_pFarmManager.drawFarmByUid(uid)
|
||||
image = await getDrawFarm().drawFarmByUid(uid)
|
||||
await MessageUtils.build_message(image).send(reply_to=True)
|
||||
|
||||
|
||||
@@ -128,12 +124,12 @@ diuse_farm.shortcut(
|
||||
@diuse_farm.assign("detail")
|
||||
async def _(session: Uninfo):
|
||||
uid = str(session.user.id)
|
||||
player = await g_pToolManager.getPlayerByUid(uid)
|
||||
player = await getToolManager().getPlayerByUid(uid)
|
||||
if player is None or not await player.isRegistered():
|
||||
await g_pToolManager.repeat()
|
||||
await getToolManager().repeat()
|
||||
return
|
||||
|
||||
info = await g_pFarmManager.drawDetailFarmByUid(uid)
|
||||
info = await getDrawFarm().drawDetailFarmByUid(uid)
|
||||
|
||||
await MessageUtils.alc_forward_msg(
|
||||
[info], session.self_id, BotConfig.self_nickname
|
||||
@@ -151,19 +147,21 @@ diuse_farm.shortcut(
|
||||
@diuse_farm.assign("my-point")
|
||||
async def _(session: Uninfo):
|
||||
uid = str(session.user.id)
|
||||
player = await g_pToolManager.getPlayerByUid(uid)
|
||||
player = await getToolManager().getPlayerByUid(uid)
|
||||
if player is None or not await player.isRegistered():
|
||||
await g_pToolManager.repeat()
|
||||
await getToolManager().repeat()
|
||||
return
|
||||
|
||||
point = player.user["point"]
|
||||
|
||||
if point < 0:
|
||||
await MessageUtils.build_message(g_sTranslation["basic"]["notFarm"]).send()
|
||||
await MessageUtils.build_message(
|
||||
config.g_sTranslation["basic"]["notFarm"]
|
||||
).send()
|
||||
return False
|
||||
|
||||
await MessageUtils.build_message(
|
||||
g_sTranslation["basic"]["point"].format(point=point)
|
||||
config.g_sTranslation["basic"]["point"].format(point=point)
|
||||
).send(reply_to=True)
|
||||
|
||||
|
||||
@@ -178,10 +176,10 @@ diuse_farm.shortcut(
|
||||
@diuse_farm.assign("seed-shop")
|
||||
async def _(session: Uninfo, res: Match[tuple[str, ...]]):
|
||||
uid = str(session.user.id)
|
||||
player = await g_pToolManager.getPlayerByUid(uid)
|
||||
player = await getToolManager().getPlayerByUid(uid)
|
||||
|
||||
if player is None or not await player.isRegistered():
|
||||
await g_pToolManager.repeat()
|
||||
await getToolManager().repeat()
|
||||
return
|
||||
|
||||
if res.result is inspect._empty:
|
||||
@@ -208,9 +206,9 @@ async def _(session: Uninfo, res: Match[tuple[str, ...]]):
|
||||
page = int(raw[1])
|
||||
|
||||
if filterKey is None:
|
||||
image = await g_pShopManager.getSeedShopImage(page, 0, 0)
|
||||
image = await CShopManager.getSeedShopImage(page, 0, 0)
|
||||
else:
|
||||
image = await g_pShopManager.getSeedShopImage(filterKey, page, 0)
|
||||
image = await CShopManager.getSeedShopImage(filterKey, page, 0)
|
||||
|
||||
await MessageUtils.build_message(image).send()
|
||||
|
||||
@@ -228,17 +226,17 @@ async def _(
|
||||
session: Uninfo, name: Match[str], num: Query[int] = AlconnaQuery("num", 1)
|
||||
):
|
||||
if not name.available:
|
||||
await MessageUtils.build_message(g_sTranslation["buySeed"]["notSeed"]).finish(
|
||||
reply_to=True
|
||||
)
|
||||
await MessageUtils.build_message(
|
||||
config.g_sTranslation["buySeed"]["notSeed"]
|
||||
).finish(reply_to=True)
|
||||
|
||||
uid = str(session.user.id)
|
||||
player = await g_pToolManager.getPlayerByUid(uid)
|
||||
player = await getToolManager().getPlayerByUid(uid)
|
||||
if player is None or not await player.isRegistered():
|
||||
await g_pToolManager.repeat()
|
||||
await getToolManager().repeat()
|
||||
return
|
||||
|
||||
result = await g_pShopManager.buySeed(uid, name.result, num.result)
|
||||
result = await CShopManager.buySeed(uid, name.result, num.result)
|
||||
await MessageUtils.build_message(result).send(reply_to=True)
|
||||
|
||||
|
||||
@@ -253,12 +251,12 @@ diuse_farm.shortcut(
|
||||
@diuse_farm.assign("my-seed")
|
||||
async def _(session: Uninfo):
|
||||
uid = str(session.user.id)
|
||||
player = await g_pToolManager.getPlayerByUid(uid)
|
||||
player = await getToolManager().getPlayerByUid(uid)
|
||||
if player is None or not await player.isRegistered():
|
||||
await g_pToolManager.repeat()
|
||||
await getToolManager().repeat()
|
||||
return
|
||||
|
||||
result = await g_pFarmManager.getUserSeedByUid(uid)
|
||||
result = await getFarmManager().getUserSeedByUid(uid)
|
||||
await MessageUtils.build_message(result).send(reply_to=True)
|
||||
|
||||
|
||||
@@ -275,17 +273,17 @@ async def _(
|
||||
session: Uninfo, name: Match[str], num: Query[int] = AlconnaQuery("num", -1)
|
||||
):
|
||||
if not name.available:
|
||||
await MessageUtils.build_message(g_sTranslation["sowing"]["notSeed"]).finish(
|
||||
reply_to=True
|
||||
)
|
||||
await MessageUtils.build_message(
|
||||
config.g_sTranslation["sowing"]["notSeed"]
|
||||
).finish(reply_to=True)
|
||||
|
||||
uid = str(session.user.id)
|
||||
player = await g_pToolManager.getPlayerByUid(uid)
|
||||
player = await getToolManager().getPlayerByUid(uid)
|
||||
if player is None or not await player.isRegistered():
|
||||
await g_pToolManager.repeat()
|
||||
await getToolManager().repeat()
|
||||
return
|
||||
|
||||
result = await g_pFarmManager.sowing(uid, name.result, num.result)
|
||||
result = await getFarmManager().sowing(uid, name.result, num.result)
|
||||
await MessageUtils.build_message(result).send(reply_to=True)
|
||||
|
||||
|
||||
@@ -300,12 +298,12 @@ diuse_farm.shortcut(
|
||||
@diuse_farm.assign("harvest")
|
||||
async def _(session: Uninfo):
|
||||
uid = str(session.user.id)
|
||||
player = await g_pToolManager.getPlayerByUid(uid)
|
||||
player = await getToolManager().getPlayerByUid(uid)
|
||||
if player is None or not await player.isRegistered():
|
||||
await g_pToolManager.repeat()
|
||||
await getToolManager().repeat()
|
||||
return
|
||||
|
||||
result = await g_pFarmManager.harvest(uid)
|
||||
result = await getFarmManager().harvest(uid)
|
||||
await MessageUtils.build_message(result).send(reply_to=True)
|
||||
|
||||
|
||||
@@ -320,12 +318,12 @@ diuse_farm.shortcut(
|
||||
@diuse_farm.assign("eradicate")
|
||||
async def _(session: Uninfo):
|
||||
uid = str(session.user.id)
|
||||
player = await g_pToolManager.getPlayerByUid(uid)
|
||||
player = await getToolManager().getPlayerByUid(uid)
|
||||
if player is None or not await player.isRegistered():
|
||||
await g_pToolManager.repeat()
|
||||
await getToolManager().repeat()
|
||||
return
|
||||
|
||||
result = await g_pFarmManager.eradicate(uid)
|
||||
result = await getFarmManager().eradicate(uid)
|
||||
await MessageUtils.build_message(result).send(reply_to=True)
|
||||
|
||||
|
||||
@@ -340,12 +338,12 @@ diuse_farm.shortcut(
|
||||
@diuse_farm.assign("my-plant")
|
||||
async def _(session: Uninfo):
|
||||
uid = str(session.user.id)
|
||||
player = await g_pToolManager.getPlayerByUid(uid)
|
||||
player = await getToolManager().getPlayerByUid(uid)
|
||||
if player is None or not await player.isRegistered():
|
||||
await g_pToolManager.repeat()
|
||||
await getToolManager().repeat()
|
||||
return
|
||||
|
||||
result = await g_pFarmManager.getUserPlantByUid(uid)
|
||||
result = await getFarmManager().getUserPlantByUid(uid)
|
||||
await MessageUtils.build_message(result).send(reply_to=True)
|
||||
|
||||
|
||||
@@ -360,12 +358,12 @@ diuse_farm.shortcut(
|
||||
@diuse_farm.assign("lock-plant")
|
||||
async def _(session: Uninfo, name: Match[str]):
|
||||
uid = str(session.user.id)
|
||||
player = await g_pToolManager.getPlayerByUid(uid)
|
||||
player = await getToolManager().getPlayerByUid(uid)
|
||||
if player is None or not await player.isRegistered():
|
||||
await g_pToolManager.repeat()
|
||||
await getToolManager().repeat()
|
||||
return
|
||||
|
||||
result = await g_pFarmManager.lockUserPlantByUid(uid, name.result, 1)
|
||||
result = await getFarmManager().lockUserPlantByUid(uid, name.result, 1)
|
||||
await MessageUtils.build_message(result).send(reply_to=True)
|
||||
|
||||
|
||||
@@ -380,12 +378,12 @@ diuse_farm.shortcut(
|
||||
@diuse_farm.assign("unlock-plant")
|
||||
async def _(session: Uninfo, name: Match[str]):
|
||||
uid = str(session.user.id)
|
||||
player = await g_pToolManager.getPlayerByUid(uid)
|
||||
player = await getToolManager().getPlayerByUid(uid)
|
||||
if player is None or not await player.isRegistered():
|
||||
await g_pToolManager.repeat()
|
||||
await getToolManager().repeat()
|
||||
return
|
||||
|
||||
result = await g_pFarmManager.lockUserPlantByUid(uid, name.result, 0)
|
||||
result = await getFarmManager().lockUserPlantByUid(uid, name.result, 0)
|
||||
await MessageUtils.build_message(result).send(reply_to=True)
|
||||
|
||||
|
||||
@@ -402,12 +400,12 @@ async def _(
|
||||
session: Uninfo, name: Match[str], num: Query[int] = AlconnaQuery("num", -1)
|
||||
):
|
||||
uid = str(session.user.id)
|
||||
player = await g_pToolManager.getPlayerByUid(uid)
|
||||
player = await getToolManager().getPlayerByUid(uid)
|
||||
if player is None or not await player.isRegistered():
|
||||
await g_pToolManager.repeat()
|
||||
await getToolManager().repeat()
|
||||
return
|
||||
|
||||
result = await g_pShopManager.sellPlantByUid(uid, name.result, num.result)
|
||||
result = await CShopManager.sellPlantByUid(uid, name.result, num.result)
|
||||
await MessageUtils.build_message(result).send(reply_to=True)
|
||||
|
||||
|
||||
@@ -422,13 +420,13 @@ reclamation = on_alconna(
|
||||
@reclamation.handle()
|
||||
async def _(session: Uninfo):
|
||||
uid = str(session.user.id)
|
||||
player = await g_pToolManager.getPlayerByUid(uid)
|
||||
player = await getToolManager().getPlayerByUid(uid)
|
||||
if player is None or not await player.isRegistered():
|
||||
await g_pToolManager.repeat()
|
||||
await getToolManager().repeat()
|
||||
return
|
||||
|
||||
condition = await g_pFarmManager.reclamationCondition(uid)
|
||||
condition += f"\n{g_sTranslation['reclamation']['confirm']}"
|
||||
condition = await getFarmManager().reclamationCondition(uid)
|
||||
condition += f"\n{config.g_sTranslation['reclamation']['confirm']}"
|
||||
await MessageUtils.build_message(condition).send(reply_to=True)
|
||||
|
||||
@waiter(waits=["message"], keep_session=True)
|
||||
@@ -437,14 +435,14 @@ async def _(session: Uninfo):
|
||||
|
||||
resp = await check.wait(timeout=60)
|
||||
if resp is None:
|
||||
await MessageUtils.build_message(g_sTranslation["reclamation"]["timeOut"]).send(
|
||||
reply_to=True
|
||||
)
|
||||
await MessageUtils.build_message(
|
||||
config.g_sTranslation["reclamation"]["timeOut"]
|
||||
).send(reply_to=True)
|
||||
return
|
||||
if not resp == "是":
|
||||
return
|
||||
|
||||
res = await g_pFarmManager.reclamation(uid)
|
||||
res = await getFarmManager().reclamation(uid)
|
||||
await MessageUtils.build_message(res).send(reply_to=True)
|
||||
|
||||
|
||||
@@ -459,26 +457,26 @@ diuse_farm.shortcut(
|
||||
@diuse_farm.assign("stealing")
|
||||
async def _(session: Uninfo, target: Match[At]):
|
||||
uid = str(session.user.id)
|
||||
player = await g_pToolManager.getPlayerByUid(uid)
|
||||
player = await getToolManager().getPlayerByUid(uid)
|
||||
if player is None or not await player.isRegistered():
|
||||
await g_pToolManager.repeat()
|
||||
await getToolManager().repeat()
|
||||
return
|
||||
|
||||
if not target.available:
|
||||
await MessageUtils.build_message(g_sTranslation["stealing"]["noTarget"]).finish(
|
||||
reply_to=True
|
||||
)
|
||||
await MessageUtils.build_message(
|
||||
config.g_sTranslation["stealing"]["noTarget"]
|
||||
).finish(reply_to=True)
|
||||
|
||||
tar = target.result
|
||||
result = await g_pDBService.user.isRegistered(tar.target)
|
||||
result = await g_pDBlocator.getUserManager().isRegistered(tar.target)
|
||||
|
||||
if not result:
|
||||
await MessageUtils.build_message(
|
||||
g_sTranslation["stealing"]["targetNotFarm"]
|
||||
config.g_sTranslation["stealing"]["targetNotFarm"]
|
||||
).send()
|
||||
return None
|
||||
|
||||
result = await g_pFarmManager.stealing(uid, tar.target)
|
||||
result = await getFarmManager().stealing(uid, tar.target)
|
||||
await MessageUtils.build_message(result).send(reply_to=True)
|
||||
|
||||
|
||||
@@ -498,12 +496,12 @@ async def _(session: Uninfo, num: Query[int] = AlconnaQuery("num", 0)):
|
||||
)
|
||||
|
||||
uid = str(session.user.id)
|
||||
player = await g_pToolManager.getPlayerByUid(uid)
|
||||
player = await getToolManager().getPlayerByUid(uid)
|
||||
if player is None or not await player.isRegistered():
|
||||
await g_pToolManager.repeat()
|
||||
await getToolManager().repeat()
|
||||
return
|
||||
|
||||
result = await g_pFarmManager.buyPointByUid(uid, num.result)
|
||||
result = await getFarmManager().buyPointByUid(uid, num.result)
|
||||
await MessageUtils.build_message(result).send(reply_to=True)
|
||||
|
||||
|
||||
@@ -518,25 +516,25 @@ diuse_farm.shortcut(
|
||||
@diuse_farm.assign("change-name")
|
||||
async def _(session: Uninfo, name: Match[str]):
|
||||
if not name.available:
|
||||
await MessageUtils.build_message(g_sTranslation["changeName"]["noName"]).finish(
|
||||
reply_to=True
|
||||
)
|
||||
await MessageUtils.build_message(
|
||||
config.g_sTranslation["changeName"]["noName"]
|
||||
).finish(reply_to=True)
|
||||
|
||||
uid = str(session.user.id)
|
||||
player = await g_pToolManager.getPlayerByUid(uid)
|
||||
player = await getToolManager().getPlayerByUid(uid)
|
||||
if player is None or not await player.isRegistered():
|
||||
await g_pToolManager.repeat()
|
||||
await getToolManager().repeat()
|
||||
return
|
||||
|
||||
player = await g_pToolManager.getPlayerByUid(uid)
|
||||
player = await getToolManager().getPlayerByUid(uid)
|
||||
if player is None:
|
||||
await MessageUtils.build_message(g_sTranslation["changeName"]["error1"]).send(
|
||||
reply_to=True
|
||||
)
|
||||
await MessageUtils.build_message(
|
||||
config.g_sTranslation["changeName"]["error1"]
|
||||
).send(reply_to=True)
|
||||
return
|
||||
|
||||
result = await player.updateName(name.result)
|
||||
await MessageUtils.build_message(g_sTranslation["changeName"][result]).send(
|
||||
await MessageUtils.build_message(config.g_sTranslation["changeName"][result]).send(
|
||||
reply_to=True
|
||||
)
|
||||
|
||||
@@ -552,17 +550,19 @@ diuse_farm.shortcut(
|
||||
@diuse_farm.assign("sign-in")
|
||||
async def _(session: Uninfo):
|
||||
uid = str(session.user.id)
|
||||
player = await g_pToolManager.getPlayerByUid(uid)
|
||||
player = await getToolManager().getPlayerByUid(uid)
|
||||
if player is None or not await player.isRegistered():
|
||||
await g_pToolManager.repeat()
|
||||
await getToolManager().repeat()
|
||||
return
|
||||
|
||||
# 判断签到是否正常加载
|
||||
if not g_bSignStatus:
|
||||
await MessageUtils.build_message(g_sTranslation["signIn"]["error"]).send()
|
||||
if not config.g_bSignStatus:
|
||||
await MessageUtils.build_message(
|
||||
config.g_sTranslation["signIn"]["error"]
|
||||
).send()
|
||||
return
|
||||
|
||||
message = await g_pSignInManager.signInByUid(uid)
|
||||
message = await getSignInManager().signInByUid(uid)
|
||||
await MessageUtils.build_message(message).send()
|
||||
|
||||
|
||||
@@ -577,12 +577,12 @@ soil_upgrade = on_alconna(
|
||||
@soil_upgrade.handle()
|
||||
async def _(session: Uninfo, index: Query[int] = AlconnaQuery("index", 1)):
|
||||
uid = str(session.user.id)
|
||||
player = await g_pToolManager.getPlayerByUid(uid)
|
||||
player = await getToolManager().getPlayerByUid(uid)
|
||||
if player is None or not await player.isRegistered():
|
||||
await g_pToolManager.repeat()
|
||||
await getToolManager().repeat()
|
||||
return
|
||||
|
||||
condition = await g_pFarmManager.soilUpgradeCondition(uid, index.result)
|
||||
condition = await getFarmManager().soilUpgradeCondition(uid, index.result)
|
||||
|
||||
await MessageUtils.build_message(condition).send(reply_to=True)
|
||||
|
||||
@@ -595,14 +595,14 @@ async def _(session: Uninfo, index: Query[int] = AlconnaQuery("index", 1)):
|
||||
|
||||
resp = await check.wait(timeout=60)
|
||||
if resp is None:
|
||||
await MessageUtils.build_message(g_sTranslation["soilInfo"]["timeOut"]).send(
|
||||
reply_to=True
|
||||
)
|
||||
await MessageUtils.build_message(
|
||||
config.g_sTranslation["soilInfo"]["timeOut"]
|
||||
).send(reply_to=True)
|
||||
return
|
||||
if not resp == "是":
|
||||
return
|
||||
|
||||
res = await g_pFarmManager.soilUpgrade(uid, index.result)
|
||||
res = await getFarmManager().soilUpgrade(uid, index.result)
|
||||
await MessageUtils.build_message(res).send(reply_to=True)
|
||||
|
||||
|
||||
@@ -617,12 +617,12 @@ diuse_farm.shortcut(
|
||||
@diuse_farm.assign("admin-up")
|
||||
async def _(session: Uninfo, num: Query[int] = AlconnaQuery("num", 0)):
|
||||
uid = str(session.user.id)
|
||||
player = await g_pToolManager.getPlayerByUid(uid)
|
||||
player = await getToolManager().getPlayerByUid(uid)
|
||||
if player is None or not await player.isRegistered():
|
||||
await g_pToolManager.repeat()
|
||||
await getToolManager().repeat()
|
||||
return
|
||||
|
||||
await g_pDBService.userSoil.nextPhase(uid, num.result)
|
||||
await g_pDBlocator.getUserSoilManager().nextPhase(uid, num.result)
|
||||
|
||||
|
||||
diuse_farm.shortcut(
|
||||
@@ -641,12 +641,12 @@ async def _(session: Uninfo, num: Query[int] = AlconnaQuery("num", 0)):
|
||||
)
|
||||
|
||||
uid = str(session.user.id)
|
||||
player = await g_pToolManager.getPlayerByUid(uid)
|
||||
player = await getToolManager().getPlayerByUid(uid)
|
||||
if player is None or not await player.isRegistered():
|
||||
await g_pToolManager.repeat()
|
||||
await getToolManager().repeat()
|
||||
return
|
||||
|
||||
result = await g_pFarmManager.pointToVipPointByUid(uid, num.result)
|
||||
result = await getFarmManager().pointToVipPointByUid(uid, num.result)
|
||||
await MessageUtils.build_message(result).send(reply_to=True)
|
||||
|
||||
|
||||
@@ -661,13 +661,15 @@ diuse_farm.shortcut(
|
||||
@diuse_farm.assign("my-vipPoint")
|
||||
async def _(session: Uninfo):
|
||||
uid = str(session.user.id)
|
||||
player = await g_pToolManager.getPlayerByUid(uid)
|
||||
player = await getToolManager().getPlayerByUid(uid)
|
||||
if player is None or not await player.isRegistered():
|
||||
await g_pToolManager.repeat()
|
||||
await getToolManager().repeat()
|
||||
return
|
||||
|
||||
await MessageUtils.build_message(
|
||||
g_sTranslation["basic"]["vipPoint"].format(vipPoint=player.user["vipPoint"])
|
||||
config.g_sTranslation["basic"]["vipPoint"].format(
|
||||
vipPoint=player.user["vipPoint"]
|
||||
)
|
||||
).send(reply_to=True)
|
||||
|
||||
|
||||
@@ -699,9 +701,9 @@ diuse_farm.shortcut(
|
||||
@diuse_farm.assign("vipSeed-shop")
|
||||
async def _(session: Uninfo, res: Match[tuple[str, ...]]):
|
||||
uid = str(session.user.id)
|
||||
player = await g_pToolManager.getPlayerByUid(uid)
|
||||
player = await getToolManager().getPlayerByUid(uid)
|
||||
if player is None or not await player.isRegistered():
|
||||
await g_pToolManager.repeat()
|
||||
await getToolManager().repeat()
|
||||
return
|
||||
|
||||
if res.result is inspect._empty:
|
||||
@@ -728,8 +730,8 @@ async def _(session: Uninfo, res: Match[tuple[str, ...]]):
|
||||
page = int(raw[1])
|
||||
|
||||
if filterKey is None:
|
||||
image = await g_pShopManager.getSeedShopImage(page, 0, 1)
|
||||
image = await CShopManager.getSeedShopImage(page, 0, 1)
|
||||
else:
|
||||
image = await g_pShopManager.getSeedShopImage(filterKey, page, 1)
|
||||
image = await CShopManager.getSeedShopImage(filterKey, page, 1)
|
||||
|
||||
await MessageUtils.build_message(image).send()
|
||||
|
||||
Reference in New Issue
Block a user