koishi-plugin-rocom 1.0.3 → 1.0.5
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.
- package/lib/client.d.ts +1 -1
- package/lib/client.js +47 -107
- package/lib/commands/account.js +48 -3
- package/lib/commands/admin.js +29 -5
- package/lib/commands/egg.js +2 -0
- package/lib/commands/merchant.js +44 -28
- package/lib/commands/query.js +11 -0
- package/lib/commands/wiki.js +2 -0
- package/lib/index.js +145 -3872
- package/lib/render-templates/menu/index.html +5 -6
- package/lib/render-templates/menu/style.css +44 -46
- package/lib/render-templates/yuanxing-shangren/index.html +29 -29
- package/lib/render.js +1 -0
- package/lib/subscription-send.d.ts +2 -1
- package/lib/subscription-send.js +13 -0
- package/package.json +2 -2
|
@@ -6,12 +6,11 @@
|
|
|
6
6
|
<title>{{pageTitle}}</title>
|
|
7
7
|
<link rel="stylesheet" href="{{_res_path}}render/menu/style.css">
|
|
8
8
|
</head>
|
|
9
|
-
<body class="page-out-client">
|
|
10
|
-
<div class="menu-cont page-section-main">
|
|
11
|
-
<
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
<div class="page-title">{{pageTitle}}</div>
|
|
9
|
+
<body class="page-out-client">
|
|
10
|
+
<div class="menu-cont page-section-main">
|
|
11
|
+
<div class="menu-page">
|
|
12
|
+
<div class="header-center">
|
|
13
|
+
<div class="page-title">{{pageTitle}}</div>
|
|
15
14
|
<div class="page-subtitle">{{pageSubtitle}}</div>
|
|
16
15
|
</div>
|
|
17
16
|
<main class="menu-content">
|
|
@@ -8,22 +8,24 @@
|
|
|
8
8
|
--helper-font-family-mianfeiziti: 'mianfeiziti', system-ui, "calibri", "Roboto", verdana, "PingFang SC", sans-serif;
|
|
9
9
|
}
|
|
10
10
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
background
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
11
|
+
html,
|
|
12
|
+
body {
|
|
13
|
+
margin: 0;
|
|
14
|
+
padding: 30px;
|
|
15
|
+
background-color: #f3eee2;
|
|
16
|
+
display: inline-block;
|
|
17
|
+
font-family: var(--helper-font-family-mianfeiziti);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
.menu-cont {
|
|
21
|
+
width: 780px;
|
|
22
|
+
background: url("../../img/ercode-bg.D1ccSQKH.png") center/cover no-repeat;
|
|
23
|
+
background-color: #f3eee2;
|
|
24
|
+
position: relative;
|
|
25
|
+
padding: 40px 50px;
|
|
26
|
+
box-sizing: border-box;
|
|
27
|
+
overflow: hidden;
|
|
28
|
+
}
|
|
27
29
|
|
|
28
30
|
.menu-cont::before {
|
|
29
31
|
content: "";
|
|
@@ -34,20 +36,10 @@ body {
|
|
|
34
36
|
pointer-events: none;
|
|
35
37
|
}
|
|
36
38
|
|
|
37
|
-
.
|
|
38
|
-
position:
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
width: 320px;
|
|
42
|
-
opacity: 0.15;
|
|
43
|
-
z-index: 2;
|
|
44
|
-
pointer-events: none;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
.menu-page {
|
|
48
|
-
position: relative;
|
|
49
|
-
z-index: 3;
|
|
50
|
-
}
|
|
39
|
+
.menu-page {
|
|
40
|
+
position: relative;
|
|
41
|
+
z-index: 3;
|
|
42
|
+
}
|
|
51
43
|
|
|
52
44
|
.header-center {
|
|
53
45
|
text-align: center;
|
|
@@ -86,28 +78,34 @@ body {
|
|
|
86
78
|
border-left: 5px solid #ffc65f;
|
|
87
79
|
}
|
|
88
80
|
|
|
89
|
-
.group-items {
|
|
90
|
-
display: grid;
|
|
91
|
-
grid-template-columns: repeat(2, 1fr);
|
|
92
|
-
gap: 15px;
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
.menu-item {
|
|
96
|
-
width: 100%;
|
|
81
|
+
.group-items {
|
|
82
|
+
display: grid;
|
|
83
|
+
grid-template-columns: repeat(2, minmax(0, 1fr));
|
|
84
|
+
gap: 15px;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
.menu-item {
|
|
88
|
+
width: 100%;
|
|
97
89
|
min-height: 85px;
|
|
98
90
|
background: url("../../img/player-bg.png") no-repeat center center;
|
|
99
91
|
background-size: 100% 100%;
|
|
100
92
|
display: flex;
|
|
101
93
|
flex-direction: column;
|
|
102
94
|
justify-content: center;
|
|
103
|
-
padding: 12px 50px 12px 25px;
|
|
104
|
-
box-sizing: border-box;
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
.menu-item-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
95
|
+
padding: 12px 50px 12px 25px;
|
|
96
|
+
box-sizing: border-box;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
.group-items > .menu-item:last-child:nth-child(odd) {
|
|
100
|
+
grid-column: 1 / -1;
|
|
101
|
+
width: calc((100% - 15px) / 2);
|
|
102
|
+
justify-self: center;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
.menu-item-cmd {
|
|
106
|
+
font-size: 22px;
|
|
107
|
+
font-weight: bold;
|
|
108
|
+
color: #5a3e1b;
|
|
111
109
|
margin-bottom: 8px;
|
|
112
110
|
line-height: 1.2;
|
|
113
111
|
}
|
|
@@ -44,7 +44,7 @@ body {
|
|
|
44
44
|
|
|
45
45
|
.merchant-page {
|
|
46
46
|
position: relative;
|
|
47
|
-
width: min(
|
|
47
|
+
width: min(1280px, 100%);
|
|
48
48
|
margin: 0 auto;
|
|
49
49
|
overflow: hidden;
|
|
50
50
|
background: #ece3d3;
|
|
@@ -91,8 +91,8 @@ body {
|
|
|
91
91
|
}
|
|
92
92
|
|
|
93
93
|
.title-badge {
|
|
94
|
-
width:
|
|
95
|
-
height:
|
|
94
|
+
width: 56px;
|
|
95
|
+
height: 56px;
|
|
96
96
|
display: flex;
|
|
97
97
|
align-items: center;
|
|
98
98
|
justify-content: center;
|
|
@@ -103,8 +103,8 @@ body {
|
|
|
103
103
|
}
|
|
104
104
|
|
|
105
105
|
.title-badge img {
|
|
106
|
-
width:
|
|
107
|
-
height:
|
|
106
|
+
width: 56px;
|
|
107
|
+
height: 56px;
|
|
108
108
|
object-fit: contain;
|
|
109
109
|
}
|
|
110
110
|
|
|
@@ -176,11 +176,11 @@ body {
|
|
|
176
176
|
|
|
177
177
|
.product-card {
|
|
178
178
|
display: grid;
|
|
179
|
-
grid-template-columns:
|
|
179
|
+
grid-template-columns: 120px 1fr auto;
|
|
180
180
|
gap: 18px;
|
|
181
181
|
align-items: center;
|
|
182
|
-
min-height:
|
|
183
|
-
padding: 18px
|
|
182
|
+
min-height: 148px;
|
|
183
|
+
padding: 18px 28px;
|
|
184
184
|
border: 1px solid rgba(118, 97, 74, 0.14);
|
|
185
185
|
border-radius: 22px;
|
|
186
186
|
background: linear-gradient(135deg, rgba(255,255,255,0.72), rgba(244,236,224,0.88));
|
|
@@ -188,9 +188,9 @@ body {
|
|
|
188
188
|
}
|
|
189
189
|
|
|
190
190
|
.product-image-container {
|
|
191
|
-
width:
|
|
192
|
-
height:
|
|
193
|
-
border-radius:
|
|
191
|
+
width: 120px;
|
|
192
|
+
height: 120px;
|
|
193
|
+
border-radius: 50%;
|
|
194
194
|
background: radial-gradient(circle at 30% 30%, rgba(255,255,255,0.94), rgba(239,228,210,0.92));
|
|
195
195
|
display: flex;
|
|
196
196
|
align-items: center;
|
|
@@ -295,14 +295,14 @@ body {
|
|
|
295
295
|
}
|
|
296
296
|
|
|
297
297
|
.product-card {
|
|
298
|
-
grid-template-columns:
|
|
298
|
+
grid-template-columns: 80px 1fr;
|
|
299
299
|
min-height: 0;
|
|
300
300
|
padding: 12px 14px;
|
|
301
301
|
}
|
|
302
302
|
|
|
303
303
|
.product-image-container {
|
|
304
|
-
width:
|
|
305
|
-
height:
|
|
304
|
+
width: 80px;
|
|
305
|
+
height: 80px;
|
|
306
306
|
}
|
|
307
307
|
|
|
308
308
|
.product-name {
|
|
@@ -312,7 +312,7 @@ body {
|
|
|
312
312
|
.product-side {
|
|
313
313
|
grid-column: 1 / -1;
|
|
314
314
|
justify-content: flex-start;
|
|
315
|
-
padding-left:
|
|
315
|
+
padding-left: 94px;
|
|
316
316
|
}
|
|
317
317
|
}
|
|
318
318
|
</style>
|
|
@@ -325,11 +325,11 @@ body {
|
|
|
325
325
|
<div class="title-section">
|
|
326
326
|
<div class="title-main">
|
|
327
327
|
<div class="title-badge">
|
|
328
|
-
{{if titleIcon}}
|
|
329
|
-
<img src="{{_res_path}}img/yuanxingshangren.png" alt="{{title}}">
|
|
330
|
-
{{else}}
|
|
331
|
-
远
|
|
332
|
-
{{/if}}
|
|
328
|
+
{{if titleIcon}}
|
|
329
|
+
<img src="{{_res_path}}img/yuanxingshangren.png" alt="{{title}}">
|
|
330
|
+
{{else}}
|
|
331
|
+
远
|
|
332
|
+
{{/if}}
|
|
333
333
|
</div>
|
|
334
334
|
<span class="title-text">{{title}}</span>
|
|
335
335
|
</div>
|
|
@@ -338,16 +338,16 @@ body {
|
|
|
338
338
|
<div class="header-side">
|
|
339
339
|
<div class="summary-chip">当前商品数 <strong>{{product_count}}</strong></div>
|
|
340
340
|
<div class="round-info">
|
|
341
|
-
<div class="round-pill">第 {{round_info.current || '未开放'}} / {{round_info.total}} 轮</div>
|
|
341
|
+
<div class="round-pill">第 {{round_info.current || '未开放'}} / {{round_info.total}} 轮</div>
|
|
342
342
|
<div class="countdown-pill">剩余 {{round_info.countdown}}</div>
|
|
343
343
|
</div>
|
|
344
344
|
</div>
|
|
345
345
|
</div>
|
|
346
346
|
|
|
347
347
|
<div class="products-grid">
|
|
348
|
-
{{if products && products.length > 0}}
|
|
349
|
-
{{each products product}}
|
|
350
|
-
<div class="product-card">
|
|
348
|
+
{{if products && products.length > 0}}
|
|
349
|
+
{{each products product}}
|
|
350
|
+
<div class="product-card">
|
|
351
351
|
<div class="product-image-container">
|
|
352
352
|
<img class="product-image" src="{{product.image}}" alt="{{product.name}}">
|
|
353
353
|
</div>
|
|
@@ -359,11 +359,11 @@ body {
|
|
|
359
359
|
<div class="product-side">
|
|
360
360
|
<div class="product-slot">本轮商品</div>
|
|
361
361
|
</div>
|
|
362
|
-
</div>
|
|
363
|
-
{{/each}}
|
|
364
|
-
{{else}}
|
|
365
|
-
<div class="product-empty">本轮暂无商品,稍后再来看看。</div>
|
|
366
|
-
{{/if}}
|
|
362
|
+
</div>
|
|
363
|
+
{{/each}}
|
|
364
|
+
{{else}}
|
|
365
|
+
<div class="product-empty">本轮暂无商品,稍后再来看看。</div>
|
|
366
|
+
{{/if}}
|
|
367
367
|
</div>
|
|
368
368
|
</div>
|
|
369
369
|
</div>
|
package/lib/render.js
CHANGED
|
@@ -5,4 +5,5 @@ export interface SubscriptionTarget {
|
|
|
5
5
|
guildId?: string;
|
|
6
6
|
userId?: string;
|
|
7
7
|
}
|
|
8
|
-
export declare function sendScheduledMessage(ctx: Context, target: SubscriptionTarget, message:
|
|
8
|
+
export declare function sendScheduledMessage(ctx: Context, target: SubscriptionTarget, message: any): Promise<boolean>;
|
|
9
|
+
export declare function sendScheduledImageWithFallback(ctx: Context, target: SubscriptionTarget, image: Buffer | null, fallbackText: string, mentionAll?: boolean): Promise<boolean>;
|
package/lib/subscription-send.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.sendScheduledMessage = sendScheduledMessage;
|
|
4
|
+
exports.sendScheduledImageWithFallback = sendScheduledImageWithFallback;
|
|
4
5
|
const koishi_1 = require("koishi");
|
|
5
6
|
const logger = new koishi_1.Logger('rocom-subscription-send');
|
|
6
7
|
function findBot(ctx, platform = '') {
|
|
@@ -46,3 +47,15 @@ async function sendScheduledMessage(ctx, target, message) {
|
|
|
46
47
|
logger.warn(`scheduled push target is incomplete: ${JSON.stringify(target)}`);
|
|
47
48
|
return false;
|
|
48
49
|
}
|
|
50
|
+
async function sendScheduledImageWithFallback(ctx, target, image, fallbackText, mentionAll = false) {
|
|
51
|
+
const prefix = mentionAll ? '@全体\n' : '';
|
|
52
|
+
if (!image) {
|
|
53
|
+
return sendScheduledMessage(ctx, target, `${prefix}${fallbackText}`);
|
|
54
|
+
}
|
|
55
|
+
const imageSegment = koishi_1.h.image(image, 'image/png');
|
|
56
|
+
const content = mentionAll ? `${prefix}${imageSegment}` : imageSegment;
|
|
57
|
+
const sent = await sendScheduledMessage(ctx, target, content);
|
|
58
|
+
if (sent)
|
|
59
|
+
return true;
|
|
60
|
+
return sendScheduledMessage(ctx, target, `${prefix}${fallbackText}`);
|
|
61
|
+
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "koishi-plugin-rocom",
|
|
3
3
|
"description": "洛克王国查询与订阅插件",
|
|
4
|
-
"version": "1.0.
|
|
4
|
+
"version": "1.0.5",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"typings": "lib/index.d.ts",
|
|
7
7
|
"homepage": "https://github.com/staytomorrow/koishi-plugin-rocom",
|
|
@@ -53,6 +53,6 @@
|
|
|
53
53
|
"database"
|
|
54
54
|
]
|
|
55
55
|
},
|
|
56
|
-
"preview":
|
|
56
|
+
"preview": false
|
|
57
57
|
}
|
|
58
58
|
}
|