koishi-plugin-ll-bns-fortune 0.2.0 → 0.2.1
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/index.js +9 -7
- package/package.json +1 -1
package/lib/index.js
CHANGED
|
@@ -542,6 +542,14 @@ exports.apply = function apply (ctx, config) {
|
|
|
542
542
|
|
|
543
543
|
const logger = safeLogger(ctx, 'll-fortune')
|
|
544
544
|
|
|
545
|
+
// 折叠起来的子配置在旧配置里可能不存在,统一在最前面兜底。
|
|
546
|
+
// ⚠️ 必须定义在所有使用者之前:const 有暂时性死区,
|
|
547
|
+
// 放到后面会在启动时直接抛 "Cannot access 'xxx' before initialization"。
|
|
548
|
+
const geom = panelGeom(config)
|
|
549
|
+
const render = renderCfg(config)
|
|
550
|
+
const storage = storageCfg(config)
|
|
551
|
+
const keywordMore = kwMore(config)
|
|
552
|
+
|
|
545
553
|
/* ---------------- 数据库表 ---------------- */
|
|
546
554
|
if (storage.databaseCache && ctx.model) {
|
|
547
555
|
try {
|
|
@@ -642,12 +650,6 @@ exports.apply = function apply (ctx, config) {
|
|
|
642
650
|
}
|
|
643
651
|
|
|
644
652
|
/* ---------------- 出图 ---------------- */
|
|
645
|
-
// 折叠起来的子配置在旧配置里可能不存在,统一在这里兜底
|
|
646
|
-
const geom = panelGeom(config)
|
|
647
|
-
const render = renderCfg(config)
|
|
648
|
-
const storage = storageCfg(config)
|
|
649
|
-
const keywordMore = kwMore(config)
|
|
650
|
-
|
|
651
653
|
async function makeImage (fortune, formatOverride) {
|
|
652
654
|
const backgroundBuffer = await getBackground()
|
|
653
655
|
const values = templateValues(fortune, config)
|
|
@@ -698,7 +700,7 @@ exports.apply = function apply (ctx, config) {
|
|
|
698
700
|
},
|
|
699
701
|
backgroundBuffer,
|
|
700
702
|
})
|
|
701
|
-
logger.info('出图完成:%
|
|
703
|
+
logger.info('出图完成:%d x %d %s,耗时 %d ms', result.width, result.height, result.mime, Date.now() - started)
|
|
702
704
|
return result
|
|
703
705
|
}
|
|
704
706
|
|