koishi-plugin-wordpress-notifier 1.5.0 → 1.6.0
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 +8 -2
- package/package.json +1 -1
package/lib/index.js
CHANGED
|
@@ -69,8 +69,14 @@ function apply(ctx, config) {
|
|
|
69
69
|
const message = formatPostMessage(post, true);
|
|
70
70
|
for (const target of config.targets) {
|
|
71
71
|
try {
|
|
72
|
-
|
|
73
|
-
|
|
72
|
+
const bot = ctx.bots[0];
|
|
73
|
+
if (bot) {
|
|
74
|
+
await bot.sendMessage(target, message);
|
|
75
|
+
ctx.logger.info(`已推送文章到 ${target}: ${post.title.rendered}`);
|
|
76
|
+
}
|
|
77
|
+
else {
|
|
78
|
+
ctx.logger.error(`没有可用的 bot 实例`);
|
|
79
|
+
}
|
|
74
80
|
}
|
|
75
81
|
catch (error) {
|
|
76
82
|
ctx.logger.error(`推送文章到 ${target} 失败: ${error}`);
|