Skip to content

Commit 3c63c8b

Browse files
committed
🎨项目结构调整,大量重构
1 parent 52f2e00 commit 3c63c8b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+701
-704
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,4 +162,6 @@ cython_debug/
162162
#.idea/
163163
*.txt
164164

165+
.vscode/
166+
165167

README.md

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ _“因光而遇”_
153153

154154
## 全局缓存目录:
155155

156-
Nonebot项目文件夹下的`sky/`目录
156+
Nonebot项目文件夹下的`Sky/`目录
157157

158158
## --全局命令管理--
159159

@@ -203,6 +203,14 @@ Nonebot项目文件夹下的`sky/`目录
203203

204204
</details>
205205

206+
## 🔧构建(开发者)
207+
208+
使用uv:
209+
210+
同步依赖: `uv sync`
211+
212+
构建:`uv build`
213+
206214

207215
## ✨TODO?✨
208216

@@ -242,6 +250,10 @@ Nonebot项目文件夹下的`sky/`目录
242250

243251
## ✨更新日志✨
244252

253+
<details>
254+
255+
<summary>>点击展开<</summary>
256+
245257
2025.1.4 v2.3.2
246258

247259
修复若干文件的绝对路径问题,使用pathlib。现已兼容Lagrange
@@ -372,10 +384,6 @@ Nonebot项目文件夹下的`sky/`目录
372384

373385
4.蜡烛查询增加对应异常捕获处理
374386

375-
<details>
376-
377-
<summary>更早的记录(2023.3.1之前)</summary>
378-
379387
2023.3.1 v2.2
380388

381389
1.新增全局自定义命令管理器,支持了99%的命令(只有定时器命令暂时无法自定义)
@@ -624,7 +632,3 @@ Nonebot项目文件夹下的`sky/`目录
624632

625633
</details>
626634

627-
## 已通过墨菲安全检测:
628-
629-
[![Security Status](https://www.murphysec.com/platform3/v3/badge/1614390303725748224.svg?t=1)](https://www.murphysec.com/accept?code=42caa007865facda50ed119894201320&type=1&from=2&t=2)
630-

__init__.py

Lines changed: 2 additions & 182 deletions
Original file line numberDiff line numberDiff line change
@@ -1,183 +1,3 @@
1-
# -*- coding: utf-8 -*-
2-
# @Author : 辉夜sama
3-
4-
# @Github : https://github.com/Kaguya233qwq
5-
import datetime
1+
from .src import nonebot_plugin_sky as nonebot_plugin_sky
62

7-
from nonebot import logger, on_command
8-
from nonebot.plugin import PluginMetadata
9-
from nonebot.params import CommandArg
10-
from nonebot.adapters.onebot.v11 import (
11-
Message,
12-
)
13-
from nonebot.permission import SUPERUSER
14-
15-
from .config.command import *
16-
from .config.msg_forward import *
17-
from .utils.bot_loader import Config
18-
from .utils import clear_cache
19-
from .utils.check_update import *
20-
from .utils.data_pack import *
21-
from .utils.notice_board import *
22-
from .config.travelling_cache import *
23-
from .tools.scheduler import *
24-
25-
RemainCN = on_command("remain -cn", aliases=get_cmd_alias("remain_cn"))
26-
RemainIN = on_command("remain -in", aliases=get_cmd_alias("remain_in"))
27-
Clear = on_command(
28-
"sky_clear_cache", aliases=get_cmd_alias("sky_clear_cache"), permission=SUPERUSER
29-
)
30-
31-
from .handler import Handler
32-
33-
# 国服每日任务
34-
on_command(
35-
"sky -cn",
36-
aliases=get_cmd_alias("sky_cn"),
37-
handlers=[Handler.chinese_server_daily_handler],
38-
)
39-
40-
# 国际服每日任务
41-
on_command(
42-
"sky -in",
43-
aliases=get_cmd_alias("sky_in"),
44-
handlers=[Handler.international_server_daily_handler],
45-
)
46-
47-
# 国服旅行先祖
48-
on_command(
49-
"tss -cn",
50-
aliases=get_cmd_alias("travel_cn"),
51-
handlers=[Handler.chinese_server_travelling_spirit_handler],
52-
)
53-
54-
# 游戏公告
55-
on_command(
56-
"notice",
57-
aliases=get_cmd_alias("sky_notice"),
58-
handlers=[Handler.get_public_notice_handler],
59-
)
60-
61-
# 排队
62-
on_command(
63-
"queue",
64-
aliases=get_cmd_alias("sky_queue"),
65-
handlers=[Handler.get_queue_state_handler],
66-
)
67-
68-
# 菜单
69-
on_command("Sky", aliases=get_cmd_alias("sky_menu"), handlers=[Handler.menu_handler])
70-
71-
72-
def remain(
73-
season_name: str,
74-
year: int,
75-
month: int,
76-
day: int,
77-
hour: int,
78-
minute: int,
79-
second: int,
80-
) -> str:
81-
"""
82-
通用季节倒计时
83-
"""
84-
85-
# @Author : ZQDesigned
86-
# @Email : [email protected]
87-
# @Github : ZQDesigned
88-
# @Software: IDEA Ultimate 2022.3.1
89-
90-
# 定义剩余时间
91-
deadline = datetime(year, month, day, hour, minute, second)
92-
# 获取当前时间
93-
now = datetime.now()
94-
# 判断当前时间是否大于截止时间
95-
if now > deadline:
96-
return "季节已经过去了,下一个季节还有一段时间呢"
97-
else:
98-
# 计算剩余时间
99-
remain_time = deadline - now
100-
# 获取天数
101-
days = remain_time.days
102-
# 获取小时
103-
hours = remain_time.seconds // 3600
104-
# 获取分钟
105-
minutes = remain_time.seconds % 3600 // 60
106-
# 获取秒
107-
seconds = remain_time.seconds % 3600 % 60
108-
# 发送剩余时间
109-
return f"距离{season_name}结束还有{days}{hours}小时{minutes}分钟{seconds}秒"
110-
111-
112-
@RemainCN.handle()
113-
async def remain_cn():
114-
results = remain("夜行季国服", 2023, 7, 19, 00, 00, 00)
115-
await RemainIN.send(results)
116-
117-
118-
@RemainIN.handle()
119-
async def remain_in():
120-
results = remain("夜行季国际服", 2023, 6, 25, 15, 00, 00)
121-
await RemainIN.send(results)
122-
123-
124-
@Clear.handle()
125-
async def _(args: Message = CommandArg()):
126-
"""
127-
清理缓存
128-
129-
- 指令名: 清理缓存
130-
- 可用参数:
131-
- day: 指定清理缓存时间段x天前,默认为30
132-
- f: 忽略上次清理时间间隔,强制执行清理
133-
- 传参方式:http params形式
134-
- 示例:day=30&force
135-
"""
136-
plain_text = args.extract_plain_text().strip()
137-
day = 30
138-
f = False
139-
if plain_text:
140-
try:
141-
plain_text = plain_text.lower()
142-
arg_list = plain_text.split("&")
143-
for arg in arg_list:
144-
if arg.startswith("day="):
145-
day = int(arg.strip()[4:])
146-
elif arg == "f" or arg == "force":
147-
f = True
148-
except Exception as exp:
149-
logger.error(plain_text, Exception=exp)
150-
await Clear.finish("参数解析错误")
151-
return
152-
if f:
153-
msg = f"开始强制清理{day}天前的数据"
154-
else:
155-
msg = f"开始清理{day}天前的数据"
156-
await Clear.send(msg)
157-
num = clear_cache(day, f)
158-
await Clear.finish(f"清理{day}天前的缓存数据,共{num}条完成")
159-
160-
161-
# nonebot的插件元数据标准
162-
__plugin_meta__ = PluginMetadata(
163-
name="Sky光遇",
164-
description="光遇的每日任务及活动相关查询插件",
165-
usage="""
166-
基本命令:
167-
光遇菜单 -> 查看插件菜单图
168-
今日国服 -> 查看今日国服任务
169-
今日国际服 -> 查看今日国际服任务
170-
国服复刻 -> 查询国服复刻先祖信息
171-
国际服复刻 -> 查询国际服复刻先祖信息
172-
173-
数据包命令:
174-
安装数据包 -> 从gitee拉取可用的静态攻略资源包
175-
菜单v2 -> 查看所有数据包命令
176-
[命令起始符]-[命令] -> 执行数据包命令
177-
""",
178-
config=Config,
179-
type="application",
180-
extra={"author": "Kaguya姬辉夜", "version": "3.0.0"},
181-
homepage="https://github.com/Kaguya233qwq/nonebot_plugin_sky",
182-
supported_adapters={"~onebot.v11"},
183-
)
3+
# 这是为了本地更好的开发和导入

config/__init__.py

Whitespace-only changes.

config/helper_at_all.py

Lines changed: 0 additions & 75 deletions
This file was deleted.

config/load_config.py

Lines changed: 0 additions & 62 deletions
This file was deleted.

0 commit comments

Comments
 (0)