Files
main_plugin_farm/__init__.py
T

79 lines
2.2 KiB
Python
Raw Normal View History

2025-03-16 19:11:05 +08:00
from nonebot import get_driver
from nonebot.plugin import PluginMetadata
2025-03-16 19:11:05 +08:00
2025-04-08 19:00:17 +08:00
from zhenxun.configs.utils import Command, PluginExtraData, RegisterConfig
2025-03-19 18:00:50 +08:00
from zhenxun.services.log import logger
2025-03-18 18:39:02 +08:00
from zhenxun.utils.message import MessageUtils
2025-03-16 19:11:05 +08:00
2025-04-08 19:00:17 +08:00
from .command import diuse_farm, diuse_register, reclamation
2025-03-18 18:39:02 +08:00
from .config import g_pJsonManager
from .database import g_pSqlManager
2025-03-20 00:45:05 +08:00
from .farm.farm import g_pFarmManager
2025-03-19 18:00:50 +08:00
from .farm.shop import g_pShopManager
2025-04-09 17:14:37 +08:00
from .request import g_pRequestManager
2025-03-18 18:39:02 +08:00
2025-03-21 00:25:20 +08:00
__plugin_meta__ = PluginMetadata(
name="真寻农场",
description="快乐的农场时光",
usage="""
2025-03-21 00:25:20 +08:00
你也要种地?
指令:
2025-03-21 23:34:19 +08:00
at 开通农场
2025-03-21 00:25:20 +08:00
我的农场
我的农场币
2025-04-09 17:14:37 +08:00
种子商店 [页数]
2025-03-21 00:25:20 +08:00
购买种子 [作物/种子名称] [数量]
我的种子
播种 [作物/种子名称] [数量]
收获
铲除
我的作物
出售作物 [作物/种子名称] [数量]
2025-03-21 18:14:50 +08:00
偷菜 at
2025-03-21 23:34:19 +08:00
开垦
2025-04-08 19:00:17 +08:00
购买农场币 [数量] 数量为消耗金币的数量
2025-03-16 19:11:05 +08:00
""".strip(),
extra=PluginExtraData(
2025-03-21 00:25:20 +08:00
author="Art_Sakura",
2025-03-16 19:11:05 +08:00
version="1.0",
2025-03-21 00:25:20 +08:00
commands=[Command(command="我的农场")],
2025-04-08 19:00:17 +08:00
menu_type="群内小游戏",
configs=[
RegisterConfig(
key="兑换倍数",
value="2",
help="金币兑换农场币的倍数 默认值为: 2倍",
default_value="2",
),
RegisterConfig(
key="手续费",
value="0.2",
help="金币兑换农场币的手续费 默认值为: 0.2 实际意义为20%手续费",
default_value="0.2",
),
RegisterConfig(
key="服务地址",
value="http://diuse.work",
help="签到、交易行、活动等服务器地址",
default_value="http://diuse.work",
)
]
2025-03-21 00:25:20 +08:00
).to_dict(),
2025-03-16 19:11:05 +08:00
)
driver = get_driver()
# 构造函数
2025-03-16 19:11:05 +08:00
@driver.on_startup
async def start():
# 初始化数据库
2025-03-16 19:11:05 +08:00
await g_pSqlManager.init()
# 初始化读取Json
2025-03-16 19:11:05 +08:00
await g_pJsonManager.init()
# 析构函数
@driver.on_shutdown
async def shutdown():
await g_pSqlManager.cleanup()