@anyul/koishi-plugin-rss 5.2.48 → 5.3.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/README.md +24 -2
- package/lib/commands/index.d.ts +32 -0
- package/lib/commands/index.js +361 -218
- package/lib/commands/subscription-create.d.ts +18 -5
- package/lib/commands/subscription-create.js +40 -28
- package/lib/commands/subscription-edit.js +5 -5
- package/lib/commands/subscription-management.js +9 -9
- package/lib/commands/web-monitor.d.ts +20 -1
- package/lib/commands/web-monitor.js +21 -19
- package/lib/constants.d.ts +1 -1
- package/lib/constants.js +2 -6
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/lib/utils/message-cache.d.ts +9 -0
- package/lib/utils/message-cache.js +36 -21
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,11 +1,33 @@
|
|
|
1
1
|
# koishi-plugin-rss-owl
|
|
2
2
|
|
|
3
3
|
[](https://www.npmjs.com/package/@anyul/koishi-plugin-rss)
|
|
4
|
-

|
|
5
5
|
|
|
6
6
|
> 功能强大的 Koishi RSS 订阅插件,支持多种订阅源、图片渲染、AI 摘要等高级功能
|
|
7
7
|
|
|
8
|
-
当前文档基于 `v5.
|
|
8
|
+
当前文档基于 `v5.3.0`,已同步命令模块化、原生子命令树、短别名与统一输出风格。
|
|
9
|
+
|
|
10
|
+
## 📖 命令文档
|
|
11
|
+
|
|
12
|
+
完整命令参考见 **[docs/COMMANDS.md](docs/COMMANDS.md)**,包含所有命令的用法、选项、示例与短别名速查表。
|
|
13
|
+
|
|
14
|
+
### 命令短别名
|
|
15
|
+
|
|
16
|
+
为方便聊天输入,每个命令都注册了 `rs` + 2 字母短别名(与完整写法等价):
|
|
17
|
+
|
|
18
|
+
| 短别名 | 完整命令 | 短别名 | 完整命令 |
|
|
19
|
+
|--------|---------|--------|---------|
|
|
20
|
+
| `rsls` | `rsso.list` | `rshm` | `rsso.html` |
|
|
21
|
+
| `rsed` | `rsso.edit` | `rsak` | `rsso.ask` |
|
|
22
|
+
| `rsrm` | `rsso.remove` | `rswt` | `rsso.watch` |
|
|
23
|
+
| `rspl` | `rsso.pull` | `rsc` | `rsso.cache` |
|
|
24
|
+
| `rsfw` | `rsso.follow` | `rsq` | `rsso.queue` |
|
|
25
|
+
|
|
26
|
+
```text
|
|
27
|
+
rsls # = rsso.list
|
|
28
|
+
rsed 1 -t "新标题" # = rsso.edit 1 -t "新标题"
|
|
29
|
+
rsc list # = rsso.cache list
|
|
30
|
+
```
|
|
9
31
|
|
|
10
32
|
## ✨ 功能特性
|
|
11
33
|
|
package/lib/commands/index.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Context } from 'koishi';
|
|
2
2
|
import type { Config } from '../types';
|
|
3
3
|
import { NotificationQueueManager } from '../core/notification-queue';
|
|
4
|
+
import { type CachedMessage, type MessageCacheManager } from '../utils/message-cache';
|
|
4
5
|
/**
|
|
5
6
|
* 管理类命令依赖
|
|
6
7
|
*/
|
|
@@ -9,12 +10,43 @@ export interface ManagementCommandDeps {
|
|
|
9
10
|
config: Config;
|
|
10
11
|
queueManager: NotificationQueueManager;
|
|
11
12
|
}
|
|
13
|
+
interface CacheCommandContext {
|
|
14
|
+
cache: MessageCacheManager;
|
|
15
|
+
platform: string;
|
|
16
|
+
guildId: string;
|
|
17
|
+
authority: number;
|
|
18
|
+
logContext?: Record<string, any>;
|
|
19
|
+
}
|
|
12
20
|
/**
|
|
13
21
|
* 注册管理类命令
|
|
22
|
+
*
|
|
23
|
+
* 设计要点(命令系统统一):
|
|
24
|
+
* - cache/queue 父命令【不带 .action()】,由 Koishi 原生「无 action → 显示 help」接管,
|
|
25
|
+
* 自动在 help 菜单/网页控制台列出子命令树。
|
|
26
|
+
* - 子命令注册为 rssowl.cache.list / rssowl.cache.stats 等真正的嵌套命令;
|
|
27
|
+
* 用户在聊天里输入 "rsso.cache list"(带空格)时,Koishi 核心路由
|
|
28
|
+
* (inferCommand, core index.mjs:1377-1405)会自动解析到 rssowl.cache.list 子命令,
|
|
29
|
+
* 输入方式与旧版完全一致,但获得了菜单可见性。
|
|
30
|
+
* - 父命令 rssowl.cache 必须无位置参数(`ctx.command('rssowl.cache', ...)`),
|
|
31
|
+
* 否则路由会在父命令处 break,导致 list 被当作位置参数而非子命令。
|
|
14
32
|
*/
|
|
15
33
|
export declare function registerManagementCommands(deps: ManagementCommandDeps): void;
|
|
34
|
+
declare function handleCacheList(cmdCtx: CacheCommandContext, args: string[], config: Config): Promise<string>;
|
|
35
|
+
declare function handleCacheMessage(cmdCtx: CacheCommandContext, args: string[], config: Config): Promise<string>;
|
|
36
|
+
declare function handleCacheSearch(cmdCtx: CacheCommandContext, args: string[], config: Config): Promise<string>;
|
|
37
|
+
declare function handleCacheStats(cmdCtx: CacheCommandContext, config: Config): Promise<string>;
|
|
38
|
+
declare function handleCacheClear(cmdCtx: CacheCommandContext, config: Config): Promise<string>;
|
|
39
|
+
declare function handleCacheCleanup(cmdCtx: CacheCommandContext, args: string[], config: Config): Promise<string>;
|
|
40
|
+
declare function handleCachePull(ctx: Context, queueManager: NotificationQueueManager, session: any, cmdCtx: CacheCommandContext, args: string[], config: Config): Promise<string>;
|
|
41
|
+
/**
|
|
42
|
+
* 按真实数据库 ID 取缓存消息,并校验其归属当前群组(防跨群越权)。
|
|
43
|
+
* 即使攻击者猜到其他群的 ID,也会因 platform/guildId 不匹配而被拦截。
|
|
44
|
+
*/
|
|
45
|
+
declare function resolveCacheMessageById(cmdCtx: CacheCommandContext, realId: number): Promise<CachedMessage | null>;
|
|
16
46
|
export { registerSubscriptionManagementCommands } from './subscription-management';
|
|
17
47
|
export { registerSubscriptionEditCommand } from './subscription-edit';
|
|
18
48
|
export { registerSubscriptionCreateCommand } from './subscription-create';
|
|
19
49
|
export { registerWebMonitorCommands } from './web-monitor';
|
|
20
50
|
export { createCommandRuntimeDeps } from './runtime';
|
|
51
|
+
export type { CacheCommandContext };
|
|
52
|
+
export { resolveCacheMessageById, handleCacheList, handleCacheMessage, handleCacheSearch, handleCacheStats, handleCacheClear, handleCacheCleanup, handleCachePull, };
|