koishi-plugin-rocom 1.0.4 → 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.
@@ -44,7 +44,7 @@ body {
44
44
 
45
45
  .merchant-page {
46
46
  position: relative;
47
- width: min(820px, 100%);
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: 68px;
95
- height: 68px;
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: 68px;
107
- height: 68px;
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: 140px 1fr auto;
179
+ grid-template-columns: 120px 1fr auto;
180
180
  gap: 18px;
181
181
  align-items: center;
182
- min-height: 156px;
183
- padding: 18px 22px;
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: 140px;
192
- height: 140px;
193
- border-radius: 18px;
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: 92px 1fr;
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: 92px;
305
- height: 92px;
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: 106px;
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>
@@ -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: string): Promise<boolean>;
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>;
@@ -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",
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": true
56
+ "preview": false
57
57
  }
58
58
  }