nonebot-plugin-aawarframe 0.3.3__tar.gz → 0.5.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (39) hide show
  1. {nonebot_plugin_aawarframe-0.3.3 → nonebot_plugin_aawarframe-0.5.0}/PKG-INFO +4 -4
  2. nonebot_plugin_aawarframe-0.5.0/nonebot_plugin_aawarframe/__init__.py +16 -0
  3. {nonebot_plugin_aawarframe-0.3.3 → nonebot_plugin_aawarframe-0.5.0}/nonebot_plugin_aawarframe/assets/templates/current_arbys.html +1 -1
  4. {nonebot_plugin_aawarframe-0.3.3 → nonebot_plugin_aawarframe-0.5.0}/nonebot_plugin_aawarframe/assets/templates/eidolon_clock.html +32 -33
  5. nonebot_plugin_aawarframe-0.5.0/nonebot_plugin_aawarframe/assets/templates/void_fissures.html +242 -0
  6. nonebot_plugin_aawarframe-0.5.0/nonebot_plugin_aawarframe/commands.py +79 -0
  7. nonebot_plugin_aawarframe-0.5.0/nonebot_plugin_aawarframe/common/__init__.py +20 -0
  8. {nonebot_plugin_aawarframe-0.3.3 → nonebot_plugin_aawarframe-0.5.0}/nonebot_plugin_aawarframe/service/arbys/__init__.py +16 -14
  9. {nonebot_plugin_aawarframe-0.3.3 → nonebot_plugin_aawarframe-0.5.0}/nonebot_plugin_aawarframe/service/archimedea/data_processor.py +1 -1
  10. {nonebot_plugin_aawarframe-0.3.3 → nonebot_plugin_aawarframe-0.5.0}/nonebot_plugin_aawarframe/service/archimedea/deep.py +4 -4
  11. {nonebot_plugin_aawarframe-0.3.3 → nonebot_plugin_aawarframe-0.5.0}/nonebot_plugin_aawarframe/service/archimedea/temporal.py +4 -4
  12. {nonebot_plugin_aawarframe-0.3.3 → nonebot_plugin_aawarframe-0.5.0}/nonebot_plugin_aawarframe/service/earth/__init__.py +5 -12
  13. nonebot_plugin_aawarframe-0.5.0/nonebot_plugin_aawarframe/service/voidfissures/__init__.py +72 -0
  14. {nonebot_plugin_aawarframe-0.3.3 → nonebot_plugin_aawarframe-0.5.0}/nonebot_plugin_aawarframe.egg-info/PKG-INFO +4 -4
  15. {nonebot_plugin_aawarframe-0.3.3 → nonebot_plugin_aawarframe-0.5.0}/nonebot_plugin_aawarframe.egg-info/SOURCES.txt +3 -3
  16. nonebot_plugin_aawarframe-0.5.0/nonebot_plugin_aawarframe.egg-info/requires.txt +5 -0
  17. {nonebot_plugin_aawarframe-0.3.3 → nonebot_plugin_aawarframe-0.5.0}/pyproject.toml +2 -2
  18. nonebot_plugin_aawarframe-0.3.3/nonebot_plugin_aawarframe/__init__.py +0 -52
  19. nonebot_plugin_aawarframe-0.3.3/nonebot_plugin_aawarframe/commands.py +0 -40
  20. nonebot_plugin_aawarframe-0.3.3/nonebot_plugin_aawarframe/common/browser_manager.py +0 -64
  21. nonebot_plugin_aawarframe-0.3.3/nonebot_plugin_aawarframe/common/data_fetcher.py +0 -9
  22. nonebot_plugin_aawarframe-0.3.3/nonebot_plugin_aawarframe/service/archimedea/__init__.py +0 -0
  23. nonebot_plugin_aawarframe-0.3.3/nonebot_plugin_aawarframe.egg-info/requires.txt +0 -5
  24. {nonebot_plugin_aawarframe-0.3.3 → nonebot_plugin_aawarframe-0.5.0}/LICENSE +0 -0
  25. {nonebot_plugin_aawarframe-0.3.3 → nonebot_plugin_aawarframe-0.5.0}/README.md +0 -0
  26. {nonebot_plugin_aawarframe-0.3.3 → nonebot_plugin_aawarframe-0.5.0}/nonebot_plugin_aawarframe/assets/ExportRegions_zh.json +0 -0
  27. {nonebot_plugin_aawarframe-0.3.3 → nonebot_plugin_aawarframe-0.5.0}/nonebot_plugin_aawarframe/assets/conquest_zh.json +0 -0
  28. {nonebot_plugin_aawarframe-0.3.3 → nonebot_plugin_aawarframe-0.5.0}/nonebot_plugin_aawarframe/assets/faction_type.json +0 -0
  29. {nonebot_plugin_aawarframe-0.3.3 → nonebot_plugin_aawarframe-0.5.0}/nonebot_plugin_aawarframe/assets/final_arbys.json +0 -0
  30. {nonebot_plugin_aawarframe-0.3.3 → nonebot_plugin_aawarframe-0.5.0}/nonebot_plugin_aawarframe/assets/mission_type.json +0 -0
  31. {nonebot_plugin_aawarframe-0.3.3 → nonebot_plugin_aawarframe-0.5.0}/nonebot_plugin_aawarframe/assets/templates/archimedea.html +0 -0
  32. {nonebot_plugin_aawarframe-0.3.3 → nonebot_plugin_aawarframe-0.5.0}/nonebot_plugin_aawarframe/assets/templates/s_arbys.html +0 -0
  33. {nonebot_plugin_aawarframe-0.3.3 → nonebot_plugin_aawarframe-0.5.0}/nonebot_plugin_aawarframe/assets/templates/today_arbys.html +0 -0
  34. {nonebot_plugin_aawarframe-0.3.3 → nonebot_plugin_aawarframe-0.5.0}/nonebot_plugin_aawarframe/assets/variables.json +0 -0
  35. {nonebot_plugin_aawarframe-0.3.3/nonebot_plugin_aawarframe/common → nonebot_plugin_aawarframe-0.5.0/nonebot_plugin_aawarframe/service}/__init__.py +0 -0
  36. {nonebot_plugin_aawarframe-0.3.3/nonebot_plugin_aawarframe/service → nonebot_plugin_aawarframe-0.5.0/nonebot_plugin_aawarframe/service/archimedea}/__init__.py +0 -0
  37. {nonebot_plugin_aawarframe-0.3.3 → nonebot_plugin_aawarframe-0.5.0}/nonebot_plugin_aawarframe.egg-info/dependency_links.txt +0 -0
  38. {nonebot_plugin_aawarframe-0.3.3 → nonebot_plugin_aawarframe-0.5.0}/nonebot_plugin_aawarframe.egg-info/top_level.txt +0 -0
  39. {nonebot_plugin_aawarframe-0.3.3 → nonebot_plugin_aawarframe-0.5.0}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: nonebot-plugin-aawarframe
3
- Version: 0.3.3
3
+ Version: 0.5.0
4
4
  Summary: aa 的 Warframe 助手
5
5
  Author-email: nekox41 <aameow@outlook.com>
6
6
  License-Expression: MIT
@@ -8,10 +8,10 @@ Requires-Python: ==3.12.*
8
8
  Description-Content-Type: text/markdown
9
9
  License-File: LICENSE
10
10
  Requires-Dist: nonebot2>=2.5.0
11
- Requires-Dist: httpx~=0.28.1
12
- Requires-Dist: nonebot-plugin-htmlkit>=0.1.0rc5
11
+ Requires-Dist: httpx>=0.28.1
13
12
  Requires-Dist: nonebot-adapter-onebot>=2.4.6
14
- Requires-Dist: playwright>=1.40.0
13
+ Requires-Dist: nonebot-plugin-htmlrender>=0.8.0
14
+ Requires-Dist: playwright>=1.61.0
15
15
  Dynamic: license-file
16
16
 
17
17
  <div align="center">
@@ -0,0 +1,16 @@
1
+ from nonebot import require
2
+ require("nonebot_plugin_htmlrender")
3
+
4
+ from nonebot.plugin import PluginMetadata
5
+ from . import commands
6
+
7
+
8
+ __plugin_meta__ = PluginMetadata(
9
+ name='nonebot-plugin-aawarframe',
10
+ description='aa 的 Warframe 插件',
11
+ usage="",
12
+ type="application",
13
+ extra={},
14
+ homepage="https://github.com/nekox41/nonebot-plugin-aawarframe",
15
+ supported_adapters={"~onebot.v11"}
16
+ )
@@ -195,7 +195,7 @@
195
195
  </div>
196
196
 
197
197
  <script>
198
- const data = {{DATA}}
198
+ const data = {{DATA}};
199
199
 
200
200
  function formatTime(timestamp) {
201
201
  const date = new Date(timestamp * 1000);
@@ -6,8 +6,7 @@
6
6
  body {
7
7
  margin: 0;
8
8
  padding: 0;
9
- width: 900px;
10
- height: 1200px;
9
+ width: 800px;
11
10
  background: linear-gradient(135deg, #fff0f5, #ffe4f0, #f8e1f0);
12
11
  display: flex;
13
12
  justify-content: center;
@@ -16,6 +15,7 @@
16
15
  "Noto Sans CJK SC", "Hiragino Sans GB", "WenQuanYi Micro Hei", sans-serif;
17
16
  position: relative;
18
17
  overflow: hidden;
18
+ min-height: 100vh;
19
19
  }
20
20
 
21
21
  /* 大量静态樱花花瓣装饰 */
@@ -50,16 +50,15 @@
50
50
  }
51
51
 
52
52
  .container {
53
- width: 720px; /* 适当缩小一点,避免太挤 */
54
- max-height: 1080px;
53
+ width: 90%; /* 铺满 body 的 90% */
55
54
  background: linear-gradient(145deg, #fff5f8, #ffe9f0, #ffe0eb);
56
- border-radius: 48px;
55
+ border-radius: 40px;
57
56
  overflow: hidden;
58
57
  box-shadow:
59
- 0 40px 90px -20px rgba(255, 105, 180, 0.45),
60
- 0 0 0 1px rgba(255, 182, 193, 0.55) inset,
61
- 0 20px 50px rgba(255, 140, 170, 0.3);
62
- border: 4px solid rgba(255, 182, 193, 0.7);
58
+ 0 30px 70px -15px rgba(255, 105, 180, 0.4),
59
+ 0 0 0 1px rgba(255, 182, 193, 0.5) inset,
60
+ 0 15px 40px rgba(255, 140, 170, 0.25);
61
+ border: 3px solid rgba(255, 182, 193, 0.65);
63
62
  position: relative;
64
63
  z-index: 1;
65
64
  }
@@ -71,7 +70,7 @@
71
70
  }
72
71
 
73
72
  td, th {
74
- padding: 26px 36px;
73
+ padding: 22px 30px;
75
74
  text-align: center;
76
75
  border: none;
77
76
  }
@@ -79,51 +78,51 @@
79
78
  /* 当前状态 */
80
79
  .state {
81
80
  background: linear-gradient(to right, #ffb3c6, #ff8fab);
82
- font-size: 1.72rem;
81
+ font-size: 1.65rem;
83
82
  font-weight: 600;
84
83
  color: #5c2a3a;
85
- letter-spacing: 2.8px;
86
- padding: 34px 36px;
84
+ letter-spacing: 2.5px;
85
+ padding: 28px 30px;
87
86
  border-bottom: 1px solid rgba(255, 255, 255, 0.8);
88
87
  }
89
88
 
90
89
  /* 剩余时间 */
91
90
  .rest {
92
91
  background: linear-gradient(to right, #ffe4f0, #ffd1e6);
93
- font-size: 2.55rem;
92
+ font-size: 2.35rem;
94
93
  font-weight: 600;
95
94
  color: #d14a7e;
96
- padding: 42px 36px;
97
- letter-spacing: 1.2px;
98
- text-shadow: 0 3px 18px rgba(255, 105, 180, 0.4);
95
+ padding: 34px 30px;
96
+ letter-spacing: 1px;
97
+ text-shadow: 0 3px 15px rgba(255, 105, 180, 0.4);
99
98
  border-bottom: 1px solid rgba(255, 255, 255, 0.75);
100
99
  }
101
100
 
102
101
  /* 标题 */
103
102
  .title {
104
103
  background: #fff0f7;
105
- font-size: 1.28rem;
104
+ font-size: 1.2rem;
106
105
  font-weight: 600;
107
106
  color: #e06a9a;
108
- letter-spacing: 4.5px;
109
- padding: 22px 36px 19px;
107
+ letter-spacing: 4px;
108
+ padding: 18px 30px 16px;
110
109
  border-bottom: 1px solid rgba(255, 182, 193, 0.45);
111
110
  }
112
111
 
113
112
  /* 时间行 */
114
113
  .time {
115
114
  background: rgba(255, 245, 250, 0.93);
116
- font-size: 2.05rem;
115
+ font-size: 1.9rem;
117
116
  font-family: ui-monospace, "SF Mono", "Menlo", "Monaco", "Consolas", monospace;
118
117
  font-weight: 500;
119
118
  color: #c05a8a;
120
- padding: 28px 36px;
121
- letter-spacing: 6px;
119
+ padding: 22px 30px;
120
+ letter-spacing: 5px;
122
121
  }
123
122
 
124
123
  tr:last-child .time {
125
- border-bottom-left-radius: 42px;
126
- border-bottom-right-radius: 42px;
124
+ border-bottom-left-radius: 36px;
125
+ border-bottom-right-radius: 36px;
127
126
  }
128
127
 
129
128
  /* 分隔线 */
@@ -135,20 +134,20 @@
135
134
  .container::before {
136
135
  content: '🌸';
137
136
  position: absolute;
138
- font-size: 52px;
139
- opacity: 0.13;
140
- top: 55px;
141
- left: 55px;
137
+ font-size: 48px;
138
+ opacity: 0.12;
139
+ top: 40px;
140
+ left: 40px;
142
141
  z-index: 0;
143
142
  }
144
143
 
145
144
  .container::after {
146
145
  content: '🌸';
147
146
  position: absolute;
148
- font-size: 72px;
149
- opacity: 0.10;
150
- top: 120px;
151
- right: 55px;
147
+ font-size: 64px;
148
+ opacity: 0.1;
149
+ top: 100px;
150
+ right: 40px;
152
151
  z-index: 0;
153
152
  }
154
153
  </style>
@@ -0,0 +1,242 @@
1
+ <!DOCTYPE html>
2
+ <html lang="zh-CN">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>普通裂缝 · 樱花</title>
7
+ <style>
8
+ * { margin: 0; padding: 0; box-sizing: border-box; }
9
+
10
+ body {
11
+ width: 800px;
12
+ margin: 0 auto;
13
+ font-family: "Microsoft YaHei", "PingFang SC", system-ui, sans-serif;
14
+ background: linear-gradient(135deg, #fff0f5, #ffe4f0, #f8e1f0);
15
+ color: #5c2a3a;
16
+ padding: 28px 0 32px;
17
+ position: relative;
18
+ overflow-x: hidden;
19
+ }
20
+
21
+ body::before {
22
+ content: '';
23
+ position: absolute;
24
+ inset: 0;
25
+ background:
26
+ radial-gradient(circle at 20% 25%, rgba(255, 182, 193, 0.25) 0%, transparent 50%),
27
+ radial-gradient(circle at 75% 35%, rgba(255, 120, 160, 0.2) 0%, transparent 48%),
28
+ radial-gradient(circle at 40% 80%, rgba(255, 200, 220, 0.22) 0%, transparent 45%);
29
+ pointer-events: none;
30
+ z-index: 0;
31
+ }
32
+
33
+ .container {
34
+ width: 90%;
35
+ margin: 0 auto;
36
+ position: relative;
37
+ z-index: 1;
38
+ }
39
+
40
+ .header {
41
+ text-align: center;
42
+ margin-bottom: 26px;
43
+ }
44
+
45
+ .header h1 {
46
+ font-size: 2.3rem;
47
+ color: #e06a9a;
48
+ letter-spacing: 2px;
49
+ }
50
+
51
+ .group {
52
+ margin-bottom: 24px;
53
+ }
54
+
55
+ .group-title {
56
+ display: flex;
57
+ align-items: center;
58
+ gap: 12px;
59
+ margin-bottom: 12px;
60
+ padding-left: 2px;
61
+ }
62
+
63
+ .group-title .modifier {
64
+ background: linear-gradient(90deg, #ffd1e6, #ff9eb5);
65
+ color: #d14a7e;
66
+ font-size: 1.15rem;
67
+ font-weight: 700;
68
+ padding: 5px 16px;
69
+ border-radius: 9999px;
70
+ box-shadow: 0 0 10px rgba(255, 105, 180, 0.3);
71
+ }
72
+
73
+ .group-title .count {
74
+ font-size: 0.92rem;
75
+ color: #c05a8a;
76
+ }
77
+
78
+ .task-list {
79
+ display: flex;
80
+ flex-direction: column;
81
+ gap: 9px;
82
+ }
83
+
84
+ .task-item {
85
+ background: rgba(255, 245, 250, 0.97);
86
+ border: 2px solid #ffb3c6;
87
+ border-radius: 15px;
88
+ padding: 12px 16px;
89
+ box-shadow: 0 5px 18px rgba(255, 140, 170, 0.14);
90
+ display: flex;
91
+ align-items: center;
92
+ gap: 12px;
93
+ position: relative;
94
+ overflow: hidden;
95
+ }
96
+
97
+ .task-item::before {
98
+ content: "🌸";
99
+ position: absolute;
100
+ font-size: 32px;
101
+ opacity: 0.07;
102
+ top: 6px;
103
+ right: 12px;
104
+ }
105
+
106
+ .left {
107
+ width: 145px;
108
+ flex-shrink: 0;
109
+ position: relative;
110
+ }
111
+
112
+ .region {
113
+ font-size: 1.18rem;
114
+ font-weight: 600;
115
+ color: #5c2a3a;
116
+ line-height: 1.2;
117
+ }
118
+
119
+ .name {
120
+ font-size: 0.95rem;
121
+ color: #c05a8a;
122
+ margin-top: 2px;
123
+ }
124
+
125
+ .faction {
126
+ position: absolute;
127
+ top: -3px;
128
+ right: 0;
129
+ background: #ffe4f0;
130
+ color: #d14a7e;
131
+ font-size: 0.7rem;
132
+ font-weight: 600;
133
+ padding: 2px 8px;
134
+ border-radius: 9999px;
135
+ border: 1px solid #ffb3c6;
136
+ }
137
+
138
+ .type {
139
+ flex: 1;
140
+ font-size: 1.28rem;
141
+ font-weight: 700;
142
+ color: #e06a9a;
143
+ text-align: center;
144
+ letter-spacing: 1px;
145
+ }
146
+
147
+ .right {
148
+ width: 125px;
149
+ flex-shrink: 0;
150
+ text-align: right;
151
+ }
152
+
153
+ .remain {
154
+ font-size: 0.92rem;
155
+ color: #b36a7f;
156
+ font-weight: 500;
157
+ white-space: nowrap;
158
+ font-variant-numeric: tabular-nums;
159
+ }
160
+ </style>
161
+ </head>
162
+ <body>
163
+ <div class="container">
164
+ <div class="header">
165
+ <h1>✦ {{TITLE}} ✦</h1>
166
+ </div>
167
+
168
+ <div id="groups">
169
+ <!-- JS 动态生成 -->
170
+ </div>
171
+ </div>
172
+
173
+ <script>
174
+ const data = {{DATA}};
175
+
176
+ const order = ["古纪", "前纪", "中纪", "后纪", "安魂", "全能"];
177
+
178
+ function getRemaining(endMs) {
179
+ const diff = Number(endMs) - Date.now();
180
+ if (diff <= 0) return "已结束";
181
+
182
+ const totalSeconds = Math.floor(diff / 1000);
183
+ const hours = Math.floor(totalSeconds / 3600);
184
+ const minutes = Math.floor((totalSeconds % 3600) / 60);
185
+ const seconds = totalSeconds % 60;
186
+
187
+ if (hours > 0) {
188
+ return `${hours}小时${minutes}分${seconds.toString().padStart(2, '0')}秒`;
189
+ } else {
190
+ return `${minutes}分${seconds.toString().padStart(2, '0')}秒`;
191
+ }
192
+ }
193
+
194
+ function render() {
195
+ const groups = {};
196
+ data.forEach(task => {
197
+ if (!groups[task.modifier]) groups[task.modifier] = [];
198
+ groups[task.modifier].push(task);
199
+ });
200
+
201
+ const sortedKeys = Object.keys(groups).sort((a, b) => {
202
+ return (order.indexOf(a) === -1 ? 99 : order.indexOf(a)) -
203
+ (order.indexOf(b) === -1 ? 99 : order.indexOf(b));
204
+ });
205
+
206
+ const container = document.getElementById('groups');
207
+ container.innerHTML = '';
208
+
209
+ sortedKeys.forEach(mod => {
210
+ const tasks = groups[mod];
211
+ const groupDiv = document.createElement('div');
212
+ groupDiv.className = 'group';
213
+
214
+ groupDiv.innerHTML = `
215
+ <div class="group-title">
216
+ <div class="modifier">${mod}</div>
217
+ <div class="count">${tasks.length} 个任务</div>
218
+ </div>
219
+ <div class="task-list">
220
+ ${tasks.map(task => `
221
+ <div class="task-item">
222
+ <div class="left">
223
+ <div class="faction">${task.faction}</div>
224
+ <div class="region">${task.region}</div>
225
+ <div class="name">${task.name}</div>
226
+ </div>
227
+ <div class="type">${task.type}</div>
228
+ <div class="right">
229
+ <div class="remain">${getRemaining(task.end)}</div>
230
+ </div>
231
+ </div>
232
+ `).join('')}
233
+ </div>
234
+ `;
235
+ container.appendChild(groupDiv);
236
+ });
237
+ }
238
+
239
+ window.onload = render;
240
+ </script>
241
+ </body>
242
+ </html>
@@ -0,0 +1,79 @@
1
+ from nonebot import on_command
2
+ from nonebot.params import CommandArg
3
+ from .service.archimedea.deep import gen_deep_img
4
+ from .service.archimedea.temporal import gen_temporal_img
5
+ from .service.earth import gen_eidolon_img
6
+ from .service.arbys import gen_current_arbys_img, gen_today_arbys_img, gen_s_arbys_img
7
+ from .service.voidfissures import gen_void_fissures_img
8
+ from nonebot.adapters.onebot.v11 import MessageEvent, MessageSegment, Message
9
+
10
+ # 夜灵平原
11
+ cetus = on_command("夜灵平原", aliases={"平原", "夜灵"})
12
+ @cetus.handle()
13
+ async def cetus_handle(event: MessageEvent):
14
+ message = Message()
15
+ message.append(MessageSegment.reply(event.message_id))
16
+ message.append(await gen_eidolon_img())
17
+ await cetus.finish(message)
18
+
19
+ # ----- Archimedea -----
20
+ temporal = on_command("时光科研", aliases={"时光"})
21
+ @temporal.handle()
22
+ async def temporal_handle(event: MessageEvent):
23
+ message = Message()
24
+ message.append(MessageSegment.reply(event.message_id))
25
+ message.append(await gen_temporal_img())
26
+ await temporal.finish(message)
27
+
28
+ # 深层科研
29
+ deep = on_command("深层科研", aliases={"深层"})
30
+ @deep.handle()
31
+ async def deep_handle(event: MessageEvent):
32
+ message = Message()
33
+ message.append(MessageSegment.reply(event.message_id))
34
+ message.append(await gen_deep_img())
35
+ await deep.finish(message)
36
+ # ----------------------
37
+
38
+ # -------- Arbitration ---------------
39
+ current_arbys = on_command("仲裁")
40
+ @current_arbys.handle()
41
+ async def current_arbys_handle(event: MessageEvent):
42
+ message = Message()
43
+ message.append(MessageSegment.reply(event.message_id))
44
+ message.append(await gen_current_arbys_img())
45
+ await current_arbys.finish(message)
46
+
47
+ today_arbys = on_command("今日仲裁")
48
+ @today_arbys.handle()
49
+ async def today_arbys_handle(event: MessageEvent):
50
+ message = Message()
51
+ message.append(MessageSegment.reply(event.message_id))
52
+ message.append(await gen_today_arbys_img())
53
+ await today_arbys.finish(message)
54
+
55
+ fast_arbys = on_command("高效仲裁")
56
+ @fast_arbys.handle()
57
+ async def fast_arbys_handle(event: MessageEvent):
58
+ message = Message()
59
+ message.append(MessageSegment.reply(event.message_id))
60
+ message.append(await gen_s_arbys_img())
61
+ await fast_arbys.finish(message)
62
+ # -----------------------------------
63
+
64
+ # ----- Void Fissures -----
65
+ vf = on_command("裂缝", aliases={"裂隙"})
66
+ @vf.handle()
67
+ async def vf_handle(event: MessageEvent):
68
+ message = Message()
69
+ message.append(MessageSegment.reply(event.message_id))
70
+ message.append(await gen_void_fissures_img(False))
71
+ await vf.finish(message)
72
+
73
+ hard_vf = on_command("钢铁裂缝", aliases={"钢铁裂隙"})
74
+ @hard_vf.handle()
75
+ async def hard_vf_handle(event: MessageEvent):
76
+ message = Message()
77
+ message.append(MessageSegment.reply(event.message_id))
78
+ message.append(await gen_void_fissures_img(True))
79
+ await hard_vf.finish(message)
@@ -0,0 +1,20 @@
1
+ import httpx
2
+ from typing import Any, Dict
3
+ from pathlib import Path
4
+
5
+ client = httpx.AsyncClient()
6
+
7
+ async def fetch_world_state() -> Dict[str, Any]:
8
+ url = "https://api.warframe.com/cdn/worldState.php"
9
+ resp = await client.get(url)
10
+ resp.raise_for_status()
11
+ return resp.json()
12
+
13
+ _ASSETS_DIR = Path(__file__).parent.parent / "assets"
14
+
15
+ async def read_template(name: str) -> str:
16
+ """根据模板名读取 assets/templates/ 下的 HTML 文件并返回文本内容"""
17
+ template_path = _ASSETS_DIR / "templates" / name
18
+ if not template_path.exists():
19
+ raise FileNotFoundError(f"模板文件不存在: {template_path}")
20
+ return template_path.read_text(encoding="utf-8")
@@ -1,10 +1,12 @@
1
1
  import json
2
2
  from pathlib import Path
3
3
  import time
4
- from nonebot.adapters.onebot.v11 import Message, MessageSegment
5
- from ...common.browser_manager import html_to_pic, read_template
4
+ from nonebot.adapters.onebot.v11 import MessageSegment
5
+ from ...common import read_template
6
+ from nonebot_plugin_htmlrender import render_html
6
7
  from datetime import datetime
7
8
 
9
+
8
10
  asset = Path(__file__).parent.parent.parent / "assets"
9
11
 
10
12
  def read_final_arbys() -> dict:
@@ -13,7 +15,7 @@ def read_final_arbys() -> dict:
13
15
  f.close()
14
16
  return final_arbys
15
17
 
16
- async def gen_current_arbys_img() -> Message:
18
+ async def gen_current_arbys_img() -> MessageSegment:
17
19
  # 读取 final_arbys
18
20
  final_arbys = read_final_arbys()
19
21
 
@@ -30,13 +32,13 @@ async def gen_current_arbys_img() -> Message:
30
32
 
31
33
  data_json = json.dumps({"current": current_arby, "next": next_arby}, ensure_ascii=False, indent=4)
32
34
 
33
- template = read_template("current_arbys")
35
+ template = await read_template("current_arbys.html")
34
36
 
35
37
  html = template.replace("{{DATA}}", data_json)
36
- img = await html_to_pic(html)
37
- return Message(MessageSegment.image(img))
38
+ img = await render_html(html)
39
+ return MessageSegment.image(bytes(img))
38
40
 
39
- async def gen_today_arbys_img() -> Message:
41
+ async def gen_today_arbys_img() -> MessageSegment:
40
42
  """
41
43
  仲裁任务固定每小时一个,获取今天 00:00:00 时的时间戳为第一个,此后每 3600 秒一个,一直到 23:00:00
42
44
  :return:
@@ -56,11 +58,11 @@ async def gen_today_arbys_img() -> Message:
56
58
  today_list.append(arby)
57
59
 
58
60
  data_json = json.dumps(today_list, ensure_ascii=False, indent=4)
59
- template = read_template("today_arbys")
60
- img = await html_to_pic(template.replace("{{DATA}}", data_json))
61
- return Message(MessageSegment.image(img))
61
+ template = await read_template("today_arbys.html")
62
+ img = await render_html(template.replace("{{DATA}}", data_json))
63
+ return MessageSegment.image(bytes(img))
62
64
 
63
- async def gen_s_arbys_img() -> Message:
65
+ async def gen_s_arbys_img() -> MessageSegment:
64
66
  """
65
67
  筛选出 5 个即将到来的 S 级仲裁。
66
68
  :return:
@@ -80,7 +82,7 @@ async def gen_s_arbys_img() -> Message:
80
82
  s_list.append(arby)
81
83
  if len(s_list) == 5:
82
84
  break
83
- template = read_template("s_arbys")
85
+ template = await read_template("s_arbys.html")
84
86
  data_json = json.dumps(s_list, ensure_ascii=False, indent=4)
85
- img = await html_to_pic(template.replace("{{DATA}}", data_json))
86
- return Message(MessageSegment.image(img))
87
+ img = await render_html(template.replace("{{DATA}}", data_json))
88
+ return MessageSegment.image(bytes(img))
@@ -4,7 +4,7 @@ from typing import Any, Dict, List, Union
4
4
  from nonebot.log import logger
5
5
 
6
6
  # ---------- 加载映射文件 ----------
7
- _ASSETS_DIR = Path(__file__).parent.parent / "assets"
7
+ _ASSETS_DIR = Path(__file__).parent.parent.parent / "assets"
8
8
 
9
9
  def _load_json(filename: str) -> Dict:
10
10
  path = _ASSETS_DIR / filename
@@ -8,8 +8,8 @@ from pathlib import Path
8
8
  from nonebot.adapters.onebot.v11 import MessageSegment
9
9
 
10
10
  from .data_processor import extract_conquests, render_archimedea_panel, transform_to_archimedea_data
11
- from ...common.browser_manager import html_to_pic
12
- from ...common.data_fetcher import fetch_world_state
11
+ from nonebot_plugin_htmlrender import render_html
12
+ from ...common import fetch_world_state
13
13
 
14
14
  _TEMPLATE_DIR = Path(__file__).parent.parent.parent / "assets" / "templates"
15
15
 
@@ -23,5 +23,5 @@ async def gen_deep_img() -> MessageSegment:
23
23
  return MessageSegment.text("未找到深层科研数据")
24
24
  data = transform_to_archimedea_data(target)
25
25
  html = render_archimedea_panel(data, str(_TEMPLATE_DIR / "archimedea.html"))
26
- img_bytes = await html_to_pic(html)
27
- return MessageSegment.image(img_bytes)
26
+ img = await render_html(html)
27
+ return MessageSegment.image(bytes(img))
@@ -8,8 +8,8 @@ from pathlib import Path
8
8
  from nonebot.adapters.onebot.v11 import MessageSegment
9
9
 
10
10
  from .data_processor import extract_conquests, render_archimedea_panel, transform_to_archimedea_data
11
- from ...common.browser_manager import html_to_pic
12
- from ...common.data_fetcher import fetch_world_state
11
+ from nonebot_plugin_htmlrender import render_html
12
+ from ...common import fetch_world_state
13
13
 
14
14
  _TEMPLATE_DIR = Path(__file__).parent.parent.parent / "assets" / "templates"
15
15
 
@@ -23,5 +23,5 @@ async def gen_temporal_img() -> MessageSegment:
23
23
  return MessageSegment.text("未找到时光科研数据")
24
24
  data = transform_to_archimedea_data(target)
25
25
  html = render_archimedea_panel(data, str(_TEMPLATE_DIR / "archimedea.html"))
26
- img_bytes = await html_to_pic(html)
27
- return MessageSegment.image(img_bytes)
26
+ img = await render_html(html)
27
+ return MessageSegment.image(bytes(img))
@@ -8,8 +8,8 @@ from pathlib import Path
8
8
 
9
9
  from nonebot.adapters.onebot.v11 import MessageSegment
10
10
 
11
- from ...common.browser_manager import html_to_pic
12
- from ...common.data_fetcher import fetch_world_state
11
+ from nonebot_plugin_htmlrender import render_html
12
+ from ...common import fetch_world_state, read_template
13
13
 
14
14
 
15
15
  _CST = timezone(timedelta(hours=8)) # 中国标准时间 UTC+8
@@ -91,10 +91,6 @@ async def extract_data() -> dict[str, object]:
91
91
 
92
92
  return result
93
93
 
94
-
95
- _TEMPLATE_DIR = Path(__file__).parent.parent.parent / "assets" / "templates"
96
-
97
-
98
94
  async def gen_eidolon_img() -> MessageSegment:
99
95
  """生成夜灵平原时钟图片"""
100
96
  data = await extract_data()
@@ -106,16 +102,13 @@ async def gen_eidolon_img() -> MessageSegment:
106
102
  )
107
103
 
108
104
  # 读取模板文件
109
- template_path = _TEMPLATE_DIR / "eidolon_clock.html"
110
- with open(template_path, "r", encoding="utf-8") as f:
111
- template = f.read()
112
-
105
+ template = await read_template("eidolon_clock.html")
113
106
  # 填充模板占位符
114
107
  html = template.replace("{{CURRENT_STATE}}", data["Current"])
115
108
  html = html.replace("{{REMAINING_TIME}}", data["ToEnd"])
116
109
  html = html.replace("{{NIGHT_TIMES_ROWS}}", night_rows)
117
110
 
118
111
  # 生成图片(CSS 已内联,无需 base_url)
119
- img_bytes = await html_to_pic(html)
112
+ img = await render_html(html)
120
113
 
121
- return MessageSegment.image(img_bytes)
114
+ return MessageSegment.image(bytes(img))
@@ -0,0 +1,72 @@
1
+ import json
2
+ from typing import List
3
+
4
+ from ...common import fetch_world_state, read_template
5
+ from nonebot_plugin_htmlrender import render_html
6
+ from nonebot.adapters.onebot.v11 import Message, MessageSegment
7
+ from pathlib import Path
8
+
9
+ ASSETS_DIR = Path(__file__).parent.parent.parent / "assets"
10
+
11
+
12
+ def void_level_map(level: str) -> str:
13
+ """
14
+ 输入虚空裂缝等级,返回中文名称
15
+ :param level: VoidT1、VoidT2...
16
+ :return:
17
+ """
18
+ void_map = {
19
+ "VoidT1": "古纪",
20
+ "VoidT2": "前纪",
21
+ "VoidT3": "中纪",
22
+ "VoidT4": "后纪",
23
+ "VoidT5": "安魂",
24
+ "VoidT6": "全能",
25
+ "null": "错误"
26
+ }
27
+ return void_map[level]
28
+
29
+ async def gen_void_fissures_img(is_hard: bool) -> MessageSegment:
30
+ """
31
+ 生成普通虚空裂缝的图片
32
+ :return: 图片消息
33
+ """
34
+ # 获取世界信息
35
+ world_state = await fetch_world_state()
36
+ all_void_fissures = world_state.get("ActiveMissions", None)
37
+ if not all_void_fissures or not isinstance(all_void_fissures, List):
38
+ return MessageSegment.text("数据源错误,请联系管理员")
39
+
40
+ # 读取地图数据,待会使用
41
+ with open(ASSETS_DIR / "ExportRegions_zh.json", "r", encoding="utf-8") as f:
42
+ nodes = json.load(f)
43
+
44
+ vf_data = []
45
+ # 遍历数组筛选指定裂缝
46
+ for void_fissure in all_void_fissures:
47
+ # 如果 is_hard 为 True 我们要筛选出
48
+
49
+ if void_fissure.get("Hard", False) != is_hard:
50
+ continue
51
+
52
+ # 摘出数据
53
+ node = nodes.get(void_fissure.get("Node", "null"), None)
54
+ vf_data.append({
55
+ "start": void_fissure["Activation"]["$date"]["$numberLong"],
56
+ "end": void_fissure["Expiry"]["$date"]["$numberLong"],
57
+ "region": node.get("systemName", "null"),
58
+ "name": node.get("name", "null"),
59
+ "type": node.get("missionName", "null"),
60
+ "faction": node.get("faction", "null"),
61
+ "modifier": void_level_map(void_fissure.get("Modifier", "null")),
62
+ })
63
+
64
+ template = await read_template("void_fissures.html")
65
+ if is_hard:
66
+ title = "虚空裂缝(钢铁)"
67
+ else:
68
+ title = "虚空裂缝(普通)"
69
+ template = template.replace("{{TITLE}}", title)
70
+ template =template.replace("{{DATA}}", json.dumps(vf_data, ensure_ascii=False, indent=4))
71
+ img = await render_html(template)
72
+ return MessageSegment.image(bytes(img))
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: nonebot-plugin-aawarframe
3
- Version: 0.3.3
3
+ Version: 0.5.0
4
4
  Summary: aa 的 Warframe 助手
5
5
  Author-email: nekox41 <aameow@outlook.com>
6
6
  License-Expression: MIT
@@ -8,10 +8,10 @@ Requires-Python: ==3.12.*
8
8
  Description-Content-Type: text/markdown
9
9
  License-File: LICENSE
10
10
  Requires-Dist: nonebot2>=2.5.0
11
- Requires-Dist: httpx~=0.28.1
12
- Requires-Dist: nonebot-plugin-htmlkit>=0.1.0rc5
11
+ Requires-Dist: httpx>=0.28.1
13
12
  Requires-Dist: nonebot-adapter-onebot>=2.4.6
14
- Requires-Dist: playwright>=1.40.0
13
+ Requires-Dist: nonebot-plugin-htmlrender>=0.8.0
14
+ Requires-Dist: playwright>=1.61.0
15
15
  Dynamic: license-file
16
16
 
17
17
  <div align="center">
@@ -19,13 +19,13 @@ nonebot_plugin_aawarframe/assets/templates/current_arbys.html
19
19
  nonebot_plugin_aawarframe/assets/templates/eidolon_clock.html
20
20
  nonebot_plugin_aawarframe/assets/templates/s_arbys.html
21
21
  nonebot_plugin_aawarframe/assets/templates/today_arbys.html
22
+ nonebot_plugin_aawarframe/assets/templates/void_fissures.html
22
23
  nonebot_plugin_aawarframe/common/__init__.py
23
- nonebot_plugin_aawarframe/common/browser_manager.py
24
- nonebot_plugin_aawarframe/common/data_fetcher.py
25
24
  nonebot_plugin_aawarframe/service/__init__.py
26
25
  nonebot_plugin_aawarframe/service/arbys/__init__.py
27
26
  nonebot_plugin_aawarframe/service/archimedea/__init__.py
28
27
  nonebot_plugin_aawarframe/service/archimedea/data_processor.py
29
28
  nonebot_plugin_aawarframe/service/archimedea/deep.py
30
29
  nonebot_plugin_aawarframe/service/archimedea/temporal.py
31
- nonebot_plugin_aawarframe/service/earth/__init__.py
30
+ nonebot_plugin_aawarframe/service/earth/__init__.py
31
+ nonebot_plugin_aawarframe/service/voidfissures/__init__.py
@@ -0,0 +1,5 @@
1
+ nonebot2>=2.5.0
2
+ httpx>=0.28.1
3
+ nonebot-adapter-onebot>=2.4.6
4
+ nonebot-plugin-htmlrender>=0.8.0
5
+ playwright>=1.61.0
@@ -1,11 +1,11 @@
1
1
  [project]
2
2
  name = "nonebot-plugin-aawarframe"
3
- version = "0.3.3"
3
+ version = "0.5.0"
4
4
  description = "aa 的 Warframe 助手"
5
5
  authors = [
6
6
  {name = "nekox41",email = "aameow@outlook.com"},
7
7
  ]
8
- dependencies = ["nonebot2>=2.5.0", "httpx~=0.28.1", "nonebot-plugin-htmlkit>=0.1.0rc5", "nonebot-adapter-onebot>=2.4.6", "playwright>=1.40.0"]
8
+ dependencies = ["nonebot2>=2.5.0", "httpx>=0.28.1", "nonebot-adapter-onebot>=2.4.6", "nonebot-plugin-htmlrender>=0.8.0", "playwright>=1.61.0"]
9
9
  requires-python = "==3.12.*"
10
10
  readme = "README.md"
11
11
  license = "MIT"
@@ -1,52 +0,0 @@
1
- import asyncio
2
- import subprocess
3
- import sys
4
-
5
- from nonebot.plugin import PluginMetadata
6
- from nonebot import get_driver
7
- from nonebot.log import logger
8
-
9
- from . import commands
10
-
11
-
12
- def _run_install():
13
- """在子线程中执行 playwright install(同步调用,由 asyncio.to_thread 包装)"""
14
- return subprocess.run(
15
- [sys.executable, "-m", "playwright", "install", "--with-deps", "--only-shell"],
16
- capture_output=True, text=True, timeout=120,
17
- )
18
-
19
-
20
- async def _init_browser():
21
- """安装 Chromium 并预启动浏览器"""
22
- logger.info("正在检查 Playwright Chromium,首次启动可能需要下载浏览器……")
23
- try:
24
- result = await asyncio.to_thread(_run_install)
25
- if result.returncode == 0:
26
- logger.info("Playwright Chromium 就绪")
27
- else:
28
- logger.warning(f"Chromium 安装可能失败: {result.stderr}")
29
- return
30
- except Exception as e:
31
- logger.warning(f"Chromium 安装检查失败: {e}")
32
- return
33
- # 预启动浏览器,避免首次调用时的冷启动延迟
34
- from .common.browser_manager import get_browser
35
- await get_browser()
36
-
37
-
38
- @get_driver().on_startup
39
- async def _init_playwright():
40
- """插件启动时初始化 Playwright(阻塞直到就绪,避免启动早期收到命令)"""
41
- await _init_browser()
42
-
43
-
44
- __plugin_meta__ = PluginMetadata(
45
- name='nonebot-plugin-aawarframe',
46
- description='aa 的 Warframe 插件',
47
- usage="",
48
- type="application",
49
- extra={},
50
- homepage="https://github.com/nekox41/nonebot-plugin-aawarframe",
51
- supported_adapters={"~onebot.v11"}
52
- )
@@ -1,40 +0,0 @@
1
- from nonebot import on_command
2
- from .service.archimedea.deep import gen_deep_img
3
- from .service.archimedea.temporal import gen_temporal_img
4
- from .service.earth import gen_eidolon_img
5
- from .service.arbys import gen_current_arbys_img, gen_today_arbys_img, gen_s_arbys_img
6
- # 夜灵平原
7
- cetus = on_command("夜灵平原")
8
-
9
- @cetus.handle()
10
- async def cetus_handle():
11
- await cetus.finish(await gen_eidolon_img())
12
-
13
- # 时光科研
14
- temporal = on_command("时光科研")
15
-
16
- @temporal.handle()
17
- async def temporal_handle():
18
- await temporal.finish(await gen_temporal_img())
19
-
20
- # 深层科研
21
- deep = on_command("深层科研")
22
-
23
- @deep.handle()
24
- async def deep_handle():
25
- await deep.finish(await gen_deep_img())
26
-
27
- current_arbys = on_command("仲裁")
28
- @current_arbys.handle()
29
- async def current_arbys_handle():
30
- await current_arbys.finish(await gen_current_arbys_img())
31
-
32
- today_arbys = on_command("今日仲裁")
33
- @today_arbys.handle()
34
- async def today_arbys_handle():
35
- await today_arbys.finish(await gen_today_arbys_img())
36
-
37
- fast_arbys = on_command("高效仲裁")
38
- @fast_arbys.handle()
39
- async def fast_arbys_handle():
40
- await fast_arbys.finish(await gen_s_arbys_img())
@@ -1,64 +0,0 @@
1
- # Playwright 浏览器单例管理
2
- # 描述:管理无头 Chromium 的生命周期,提供 html_to_pic 渲染接口
3
- # 作者:aa
4
- # 2026年7月22日
5
-
6
- from typing import Optional
7
- from pathlib import Path
8
- from nonebot.log import logger
9
- from playwright.async_api import Browser, Page, Playwright, async_playwright
10
-
11
- _playwright: Optional[Playwright] = None
12
- _browser: Optional[Browser] = None
13
- TEMPLATES_DIR = Path(__file__).parent .parent / "assets" / "templates"
14
-
15
- async def _launch_browser() -> Browser:
16
- """启动无头 Chromium 浏览器实例"""
17
- global _playwright, _browser
18
- _playwright = await async_playwright().start()
19
- _browser = await _playwright.chromium.launch(headless=True)
20
- logger.info("Playwright 无头 Chromium 已启动")
21
- return _browser
22
-
23
-
24
- async def get_browser() -> Browser:
25
- """获取浏览器单例,首次调用时自动启动"""
26
- global _browser
27
- if _browser is None or not _browser.is_connected():
28
- _browser = await _launch_browser()
29
- return _browser
30
-
31
-
32
- async def html_to_pic(html: str) -> bytes:
33
- """
34
- 将 HTML 字符串渲染为 PNG 图片字节
35
-
36
- :param html: 完整的 HTML 字符串
37
- :return: PNG 图片二进制数据
38
- """
39
- browser = await get_browser()
40
- page: Page = await browser.new_page()
41
- try:
42
- await page.set_content(html, wait_until="networkidle")
43
- await page.wait_for_timeout(3000)
44
- body = page.locator("body")
45
- return await body.screenshot(type="png")
46
- finally:
47
- await page.close()
48
-
49
-
50
- async def shutdown_browser():
51
- """关闭浏览器和 Playwright,用于插件卸载时清理"""
52
- global _browser, _playwright
53
- if _browser is not None:
54
- await _browser.close()
55
- _browser = None
56
- if _playwright is not None:
57
- await _playwright.stop()
58
- _playwright = None
59
- logger.info("Playwright 浏览器已关闭")
60
-
61
- def read_template(name: str) -> str:
62
- """根据文件名从 templates 下读取模板,返回字符串。"""
63
- with open(TEMPLATES_DIR / f"{name}.html", "r", encoding="utf-8") as f:
64
- return f.read()
@@ -1,9 +0,0 @@
1
- import httpx
2
- from typing import Any, Dict
3
-
4
- async def fetch_world_state() -> Dict[str, Any]:
5
- url = "https://api.warframe.com/cdn/worldState.php"
6
- async with httpx.AsyncClient() as client:
7
- resp = await client.get(url)
8
- resp.raise_for_status()
9
- return resp.json()
@@ -1,5 +0,0 @@
1
- nonebot2>=2.5.0
2
- httpx~=0.28.1
3
- nonebot-plugin-htmlkit>=0.1.0rc5
4
- nonebot-adapter-onebot>=2.4.6
5
- playwright>=1.40.0