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.
Files changed (2) hide show
  1. package/lib/index.js +8 -2
  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
- await ctx.broadcast([target], message);
73
- ctx.logger.info(`已推送文章到 ${target}: ${post.title.rendered}`);
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}`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "koishi-plugin-wordpress-notifier",
3
- "version": "1.5.0",
3
+ "version": "1.6.0",
4
4
  "description": "WordPress 文章自动推送到 QQ",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",