koishi-plugin-wordpress-notifier 1.7.0 → 1.7.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/README.md +83 -43
- package/lib/index.d.ts +5 -2
- package/lib/index.js +18 -14
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -2,15 +2,16 @@
|
|
|
2
2
|
|
|
3
3
|
自动从 WordPress 网站获取最新文章并推送到指定 QQ 群或私聊。
|
|
4
4
|
|
|
5
|
-
## 功能特性
|
|
6
|
-
|
|
7
|
-
- ✅ 自动从 WordPress REST API 获取最新文章
|
|
8
|
-
- ✅ 定时推送新文章到指定 QQ 群或私聊
|
|
9
|
-
- ✅ 支持手动查询最新文章和文章列表
|
|
10
|
-
- ✅
|
|
11
|
-
- ✅
|
|
12
|
-
- ✅
|
|
13
|
-
- ✅
|
|
5
|
+
## 功能特性
|
|
6
|
+
|
|
7
|
+
- ✅ 自动从 WordPress REST API 获取最新文章
|
|
8
|
+
- ✅ 定时推送新文章到指定 QQ 群或私聊
|
|
9
|
+
- ✅ 支持手动查询最新文章和文章列表
|
|
10
|
+
- ✅ 支持查询 WordPress 站点用户信息
|
|
11
|
+
- ✅ 支持 @全体成员
|
|
12
|
+
- ✅ 完善的去重机制,避免重复推送
|
|
13
|
+
- ✅ 数据库持久化存储,机器人重启不丢失记录
|
|
14
|
+
- ✅ 采用服务模式架构,便于扩展和维护
|
|
14
15
|
- ✅ 支持自动推送开关
|
|
15
16
|
|
|
16
17
|
## 安装
|
|
@@ -97,14 +98,30 @@ plugins:
|
|
|
97
98
|
|
|
98
99
|
开启或关闭自动推送功能。
|
|
99
100
|
|
|
100
|
-
### 切换 @全体成员 开关
|
|
101
|
-
|
|
102
|
-
```
|
|
103
|
-
/wordpress.mention
|
|
104
|
-
```
|
|
105
|
-
|
|
106
|
-
开启或关闭 @全体成员 功能。
|
|
107
|
-
|
|
101
|
+
### 切换 @全体成员 开关
|
|
102
|
+
|
|
103
|
+
```
|
|
104
|
+
/wordpress.mention
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
开启或关闭 @全体成员 功能。
|
|
108
|
+
|
|
109
|
+
### 查看站点用户列表
|
|
110
|
+
|
|
111
|
+
```
|
|
112
|
+
/wordpress.users
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
显示 WordPress 站点的所有用户列表,包含用户 ID、名称、角色和个人主页链接。
|
|
116
|
+
|
|
117
|
+
### 查看特定用户信息
|
|
118
|
+
|
|
119
|
+
```
|
|
120
|
+
/wordpress.user <id>
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
显示指定 ID 用户的详细信息,包括用户 ID、昵称、角色、个人主页、注册时间和个人简介。
|
|
124
|
+
|
|
108
125
|
### 插件菜单
|
|
109
126
|
|
|
110
127
|
```
|
|
@@ -204,32 +221,55 @@ cd external/wordpress-notifier
|
|
|
204
221
|
npm install
|
|
205
222
|
```
|
|
206
223
|
|
|
207
|
-
## 版本历史
|
|
208
|
-
|
|
209
|
-
### 1.
|
|
210
|
-
|
|
211
|
-
-
|
|
212
|
-
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
-
|
|
218
|
-
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
- 🐛
|
|
225
|
-
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
-
|
|
231
|
-
|
|
232
|
-
|
|
224
|
+
## 版本历史
|
|
225
|
+
|
|
226
|
+
### 1.7.1 (2026-01-19)
|
|
227
|
+
|
|
228
|
+
- 🐛 修复用户查询功能中 roles 字段为 undefined 的错误
|
|
229
|
+
- 📝 更新 README.md 文档,添加用户查询功能说明
|
|
230
|
+
|
|
231
|
+
### 1.7.0 (2026-01-19)
|
|
232
|
+
|
|
233
|
+
- ✨ 新增查询 WordPress 站点用户信息功能
|
|
234
|
+
- ✅ 添加 `/wordpress.users` 命令,查看站点用户列表
|
|
235
|
+
- ✅ 添加 `/wordpress.user <id>` 命令,查看特定用户信息
|
|
236
|
+
- 📝 更新主菜单,添加新命令选项
|
|
237
|
+
- 🔧 优化数据库表定义
|
|
238
|
+
|
|
239
|
+
### 1.6.0 (2026-01-15)
|
|
240
|
+
|
|
241
|
+
- 🐛 修复消息发送问题,使用 `bot.sendMessage` 替代 `broadcast`
|
|
242
|
+
- 🔧 优化消息发送逻辑
|
|
243
|
+
|
|
244
|
+
### 1.5.0 (2026-01-15)
|
|
245
|
+
|
|
246
|
+
- 🐛 修复数据库主键问题,添加 `id` 字段作为主键
|
|
247
|
+
- 🔧 优化数据库表结构
|
|
248
|
+
|
|
249
|
+
### 1.3.0 (2024-01-14)
|
|
250
|
+
|
|
251
|
+
- 📝 更新作者邮箱为 kate522@88.com
|
|
252
|
+
- 🔗 更新仓库地址为正确的 GitHub URL
|
|
253
|
+
- 📝 优化 README.md 文档和链接
|
|
254
|
+
|
|
255
|
+
### 1.2.0 (2024-01-14)
|
|
256
|
+
|
|
257
|
+
- 📝 优化 README.md 文档,添加详细的安装说明和常见问题
|
|
258
|
+
- 📦 优化 npm 包结构,只包含必要文件
|
|
259
|
+
|
|
260
|
+
### 1.1.0 (2024-01-14)
|
|
261
|
+
|
|
262
|
+
- ✨ 新增数据库持久化存储功能
|
|
263
|
+
- 🐛 修复推送目标配置问题,使用 `ctx.broadcast([target], message)` 正确发送到指定目标
|
|
264
|
+
- 🐛 修复 HTTP 服务注入问题,添加 `'http'` 到 inject 数组
|
|
265
|
+
- 📝 添加 `.npmignore` 文件,确保 npm 发布时只包含必要文件
|
|
266
|
+
- 📦 更新依赖项
|
|
267
|
+
|
|
268
|
+
### 1.0.0 (初始版本)
|
|
269
|
+
|
|
270
|
+
- 🎉 首次发布
|
|
271
|
+
- ✅ 基础推送功能
|
|
272
|
+
- ✅ 命令系统
|
|
233
273
|
- ✅ 去重机制
|
|
234
274
|
|
|
235
275
|
## 许可证
|
package/lib/index.d.ts
CHANGED
|
@@ -38,8 +38,11 @@ export interface WordPressUser {
|
|
|
38
38
|
'48': string;
|
|
39
39
|
'96': string;
|
|
40
40
|
};
|
|
41
|
-
registered_date
|
|
42
|
-
roles
|
|
41
|
+
registered_date?: string;
|
|
42
|
+
roles?: string[];
|
|
43
|
+
slug?: string;
|
|
44
|
+
url?: string;
|
|
45
|
+
meta?: any[];
|
|
43
46
|
}
|
|
44
47
|
export interface WordPressPostRecord {
|
|
45
48
|
id: number;
|
package/lib/index.js
CHANGED
|
@@ -151,7 +151,8 @@ function apply(ctx, config) {
|
|
|
151
151
|
}
|
|
152
152
|
let message = '👥 WordPress 站点用户列表:\n\n';
|
|
153
153
|
for (const user of users) {
|
|
154
|
-
|
|
154
|
+
const roles = user.roles || [];
|
|
155
|
+
message += `${user.id}. ${user.name}(${roles.join(', ') || '普通用户'})\n`;
|
|
155
156
|
message += `🔗 ${user.link}\n\n`;
|
|
156
157
|
}
|
|
157
158
|
return message;
|
|
@@ -170,12 +171,15 @@ function apply(ctx, config) {
|
|
|
170
171
|
let message = `👤 用户信息:\n\n`;
|
|
171
172
|
message += `ID: ${user.id}\n`;
|
|
172
173
|
message += `昵称: ${user.name}\n`;
|
|
173
|
-
|
|
174
|
+
const roles = user.roles || [];
|
|
175
|
+
message += `角色: ${roles.join(', ') || '普通用户'}\n`;
|
|
174
176
|
message += `个人主页: ${user.link}\n`;
|
|
175
177
|
if (user.description) {
|
|
176
178
|
message += `简介: ${user.description.replace(/<[^>]*>/g, '')}\n`;
|
|
177
179
|
}
|
|
178
|
-
|
|
180
|
+
if (user.registered_date) {
|
|
181
|
+
message += `注册时间: ${new Date(user.registered_date).toLocaleString('zh-CN')}\n`;
|
|
182
|
+
}
|
|
179
183
|
return message;
|
|
180
184
|
});
|
|
181
185
|
ctx.command('wordpress.push', '手动推送最新文章')
|
|
@@ -210,17 +214,17 @@ function apply(ctx, config) {
|
|
|
210
214
|
ctx.command('wordpress', 'WordPress 推送插件菜单')
|
|
211
215
|
.action(() => {
|
|
212
216
|
ctx.logger.info('命令 wordpress 被调用');
|
|
213
|
-
return `📚 WordPress 推送插件菜单:
|
|
214
|
-
|
|
215
|
-
🔹 /wordpress.status - 查看插件状态
|
|
216
|
-
🔹 /wordpress.latest - 查看最新文章
|
|
217
|
-
🔹 /wordpress.list - 查看文章列表
|
|
218
|
-
🔹 /wordpress.users - 查看站点用户列表
|
|
219
|
-
🔹 /wordpress.user <id> - 查看特定用户信息
|
|
220
|
-
🔹 /wordpress.push - 手动推送最新文章
|
|
221
|
-
🔹 /wordpress.toggle - 切换自动推送开关
|
|
222
|
-
🔹 /wordpress.mention - 切换 @全体成员 开关
|
|
223
|
-
|
|
217
|
+
return `📚 WordPress 推送插件菜单:
|
|
218
|
+
|
|
219
|
+
🔹 /wordpress.status - 查看插件状态
|
|
220
|
+
🔹 /wordpress.latest - 查看最新文章
|
|
221
|
+
🔹 /wordpress.list - 查看文章列表
|
|
222
|
+
🔹 /wordpress.users - 查看站点用户列表
|
|
223
|
+
🔹 /wordpress.user <id> - 查看特定用户信息
|
|
224
|
+
🔹 /wordpress.push - 手动推送最新文章
|
|
225
|
+
🔹 /wordpress.toggle - 切换自动推送开关
|
|
226
|
+
🔹 /wordpress.mention - 切换 @全体成员 开关
|
|
227
|
+
|
|
224
228
|
💡 提示:所有命令都需要加 / 前缀`;
|
|
225
229
|
});
|
|
226
230
|
ctx.on('ready', async () => {
|