Commit 96fc6f2c authored by nanahira's avatar nanahira

readme

parent da0766f3
# koishi-nestjs
[Nest.js](http://nestjs.com/) 下的 [Koishi](https://koishi.js.org) 模块。koishi-nestjs 在 Nest.js 下使用 Koishi 打造规模化的机器人应用。
[Nest.js](http://nestjs.com/) 下的 [Koishi](https://koishi.chat) 模块。koishi-nestjs 在 Nest.js 下使用 Koishi 打造规模化的机器人应用。
## 文档
[https://koishi.js.org/community/decorator/nestjs.html](https://koishi.js.org/community/decorator/nestjs.html)
## 安装
```bash
npm install koishi-nestjs koishi
```
## 配置模块
koishi-nestjs 中,Koishi 以 NestJS 的模块的形式引入到项目工程中。我们支持同步和异步两种配置方式。
另外,KoishiModule 会被注册为 [全局模块](https://docs.nestjs.cn/9/modules?id=%e5%85%a8%e5%b1%80%e6%a8%a1%e5%9d%97)。在项目的任何模块中注册 KoishiModule 后,在项目的任何位置均能使用 Koishi 的功能。
### 同步
```ts
import { Module } from '@nestjs/common'
import { KoishiModule, PluginDef } from 'koishi-nestjs'
import PluginOnebot from '@koishijs/plugin-onebot'
@Module({
imports: [
KoishiModule.register({
// 在这里填写 Koishi 配置参数
prefix: '.',
usePlugins: [
// 预安装的插件
PluginDef(PluginOnebot, {
protocol: 'ws',
endpoint: 'ws://localhost:6700',
selfId: '111514',
token: 'koishi',
}),
],
}),
],
})
export class AppModule {}
```
### 异步
```ts
import { Module } from '@nestjs/common'
import { ConfigModule, ConfigService } from '@nestjs/config'
import { KoishiModule, PluginDef } from 'koishi-nestjs'
import PluginOnebot from '@koishijs/plugin-adapter-onebot'
@Module({
imports: [
KoishiModule.registerAsync({
imports: [ConfigModule.forRoot()],
inject: [ConfigService],
useFactory: async (config: ConfigService) => ({
// 在这里填写 Koishi 配置参数
prefix: '.',
usePlugins: [
// 预安装的插件
PluginDef(PluginOnebot, {
protocol: 'ws',
endpoint: config.get('CQ_ENDPOINT'),
selfId: config.get('CQ_SELFID'),
token: config.get('CQ_TOKEN'),
}),
],
}),
}),
],
})
export class AppModule {}
```
### 配置项
koishi-nestjs 的配置项和 [Koishi 配置项](https://koishi.chat/api/core/app.html) 基本一致,下面是 koishi-nestjs 特有的配置项:
- **loggerPrefix:** `string` Nest 日志中 Logger 的前缀。默认 `koishi`
- **loggerColor:** `number` Nest 日志中 Logger 的颜色支持。默认 `0`
- **usePlugins:** `KoishiModulePlugin[]` 可选。预先安装的 Koishi 插件列表。使用 `PluginDef(plugin, options, select)` 方法生成该项的定义。该配置项的成员参数如下。
- **plugin:** Koishi 插件。
- **options:** Koishi 插件配置。等同于 `ctx.plugin(plugin, options)`
- **select:** 可选,Selection 对象,指定插件的 [上下文选择器](https://koishi.chat/guide/plugin/selector.html#%E9%85%8D%E7%BD%AE%E6%8F%92%E4%BB%B6%E4%B8%8A%E4%B8%8B%E6%96%87)
- **moduleSelection:** `KoishiModuleSelection[]` 可选。指定 Nest 实例加载的其他 Nest 模块注入的 Koishi 上下文选择器,参数如下:
- **module:** Nest 模块类。
- **select:** Selection 对象,指定插件的 [上下文选择器](https://koishi.chat/guide/plugin/selector.html#%E9%85%8D%E7%BD%AE%E6%8F%92%E4%BB%B6%E4%B8%8A%E4%B8%8B%E6%96%87)
- **useWs:** `boolean` 是否启用 WebSocket 网关。**异步配置该项应写入异步配置项中**,而不是写在 `useFactory` 中。默认 `false`
- **actionErrorMessage:** `string` 指令中发生未知错误时,机器人返回的信息。默认 `Internal Server Error`
- **templateParams:** 定义注册的 [插值上下文对象](#插值定义)
#### 不支持的配置项
由于 koishi-nestjs 复用了 NestJS 实例的 HttpServer 对象,因此下列关于 HttpServer 监听的选项将不受支持:
- `port`
- `host`
### WebSocket 服务器
和直接运行 Koishi 不同,Nest.js 中的 Koishi 模块并不会直接注册 HttpServer,而是将 HttpServer 与 NestJS 中的 HttpServer 进行绑定。而 WebSocket 使用的也是 NestJS 中的 [WebSocket 网关](https://docs.nestjs.cn/9/websockets)。因此若要使用到如 [console](https://koishi.chat/plugins/console/index.html)[adapter-onebot](https://koishi.chat/plugins/adapter/onebot.html#%E5%8F%8D%E5%90%91-websocket) 的反向 WebSocket 功能的插件,需要在 NestJS 实例注册时进行一些额外的配置。
为了与 Koishi 更好地适配 NestJS 的 WebSocket 功能,koishi-nestjs 提供了基于 @nestjs/platform-ws 的专用 NestJS WebSocket 适配器。我们需要在 Koishi 模块配置中设置 `useWs``true`,并加载专用 WebSocket 适配器:
```ts
// app.module.ts
import { Module } from '@nestjs/common'
import { ConfigModule, ConfigService } from '@nestjs/config'
import { KoishiModule, PluginDef } from 'koishi-nestjs'
import PluginOnebot from '@koishijs/plugin-adapter-onebot'
@Module({
imports: [
KoishiModule.registerAsync({
imports: [ConfigModule.forRoot()],
inject: [ConfigService],
useWs: true,
useFactory: async (config: ConfigService) => ({
// 在这里填写 Koishi 配置参数
prefix: '.',
usePlugins: [
// 预安装的插件
PluginDef(PluginOnebot, {
protocol: 'ws',
endpoint: config.get('CQ_ENDPOINT'),
selfId: config.get('CQ_SELFID'),
token: config.get('CQ_TOKEN'),
}),
],
}),
}),
]
})
export class AppModule {}
// main.ts
const app = await NestFactory.create(AppModule)
app.useWebSocketAdapter(new KoishiWsAdapter(app))
```
该适配器拥有和 @nestjs/platform-ws 适配器基本一致的功能。在 NestJS 工程内您可以如同正常的 WebSocket 适配器一般使用它。
## 注入 Koishi 实例
作为开发方式的一种,您可以在 NestJS 的控制器或提供者类中直接对 Koishi 实例或上下文进行注入操作。
这种情况下,建议让 Nest 提供者类实现 `OnModuleInit` 接口,并在该事件方法中进行 Koishi 指令注册操作。
koishi-nestjs 将在 NestJS 应用启动时启动 Koishi 实例。
### 注入上下文
```ts
@Injectable()
export class AppService implements OnModuleInit {
constructor(@InjectContext() private ctx: Context) {}
onModuleInit() {
this.ctx.on('message', (session) => {})
}
}
```
### 注入某一特定上下文
```ts
@Injectable()
export class AppService implements OnModuleInit {
constructor(@InjectContextGuild('1111111111') private ctx: Context) {}
onModuleInit() {
this.ctx.on('message', (session) => {})
}
}
```
### 装饰器定义
在 Nest 提供者构造函数参数列表中使用下列装饰器即可进行注入操作。
- `@InjectContext()` 注入全体上下文。等价于 `ctx.any()`
- `@InjectContextPrivate(...values[]: string)` 注入私聊上下文。等价于 `ctx.private(...values)`
- `@InjectContextChannel(...values[]: string)` 注入频道上下文。等价于 `ctx.channel(...values)`
- `@InjectContextGuild(...values[]: string)` 注入群组上下文。等价于 `ctx.guild(...values)`
- `@InjectContextSelf(...values[]: string)` 注入机器人账户上下文。等价于 `ctx.self(...values)`
- `@InjectContextUser(...values[]: string)` 注入用户上下文。等价于 `ctx.user(...values)`
- `@InjectContextPlatform(...values[]: string)` 注入平台上下文。等价于 `ctx.platform(...values)`
### 在自定义提供者注入 Koishi 上下文
您将需要使用函数 `getContextProvideToken()` 进行注入操作,如下例。
```ts
import { Module } from '@nestjs/common'
import { KoishiModule, getContextProvideToken } from 'koishi-nestjs'
import { AppService } from './app.service'
import { Context } from 'koishi'
@Module({
imports: [
KoishiModule.register({...})
],
providers: [
{
provide: AppService,
inject: [getContextProvideToken()],
useFactory: (ctx: Context) => new AppService(ctx),
},
],
})
export class AppModule {}
```
#### 函数定义
```ts
function getContextProvideToken(scopeType?: ContextScopeTypes, values: string[] = [])
```
- **scopeType:** 选择器类型,可以是 `private` `channel` `guild` `self` `user` `platform` 之一。留空表示全局上下文。
- **values:** 选择器值。例如 `getContextProvideToken('platform', ['onebot'])` 等价于 `ctx.platform('onebot')`
## 在提供者类中注册方法
您也可以在提供者类中,使用装饰器进行 Koishi 的中间件,事件,指令等方法注册,也可以加载插件。
```ts
@Injectable()
export class AppService {
// 注册中间件
@UseMiddleware()
simpleMiddleware(session: Session, next: NextFunction) {
if (session.content === 'pang') {
return 'peng'
}
return next()
}
// 注册事件监听器
@UseEvent('message')
async onMessage(session: Session) {
if (session.content === 'ping') {
await session.send('pong')
}
}
// 注册指令
@UseCommand('dress', '穿裙子')
@CommandUsage('今天穿裙子了吗?')
onDressCommand(
@PutOption('color', '-c <color:string> 裙子的颜色') color: string,
@PutUserName() name: string,
) {
return `${name} 今天穿的裙子的颜色是 ${color}。`
}
}
```
装饰器定义与 [koishi-thirdeye](./thirdeye.md#注册事件) 中一致。但是下列存在于 koishi-thirdeye 的功能由于 NestJS 已经提供,因此在 koishi-nestjs 中不受支持。
- `@Get` 等 HTTP 路由注册方法。请使用 NestJS 的控制器。
- `@Ws` 请使用 NestJS 的 WebSocket 网关。
### 错误处理
在 koishi-nestjs 的指令处理中,若抛出 NestJS 中的 `HttpException``WsException` 的异常时,系统将会以其中的返回信息作为机器人发送给用户的错误信息。
若遇到未知的错误,机器人则会返回给用户 `Internal Server Error` 信息。要改变这一错误信息,可以使用 `actionErrorMessage` 配置选项。设置成空字符串可以完全禁用这一行为。
```ts
@Injectable()
export class AppService {
@UseCommand('dress', '穿裙子')
@CommandUsage('今天穿裙子了吗?')
onDressCommand(
@PutOption('color', '-c <color:string> 裙子的颜色') color: string,
@PutUserName() name: string,
) {
throw new NotFoundException(`${name} 今天没有穿裙子!`)
}
}
```
## 选择器
选择器装饰器可以注册在提供者类顶部,也可以注册在提供者方法函数。定义与 [koishi-thirdeye](./thirdeye.md#选择器) 相同。
具有选择器定义的 NestJS 提供者类注入的 Koishi 上下文对象,也会受到这些选择器定义的影响。
```ts
@OnPlatform('onebot')
@Injectable()
export class AppService implements OnModuleInit {
constructor(@InjectContext() private ctx: Context) {}
onModuleInit() {
// 只对 OneBot 平台生效
this.ctx.on('message', (session) => {})
}
}
```
## 插值定义
[koishi-thirdeye](https://www.npmjs.com/package/koishi-thirdeye) 类似,koishi-nestjs 也提供了插值定义的功能,以灵活给地为。
koishi-nestjs 的选择器和指令方法注册装饰器均支持插值,插值上下文由配置的 templateParams 属性提供。
```ts
// app.service.ts
@Injectable()
export class AppService {
@UseCommand('{{dress.commandName}}')
onDressCommand(
@PutValue('{{dress.color}}') color: string,
@PutValue('{{dress.size}}') size: string,
) {
return `您穿的裙子是 ${color} 色的,大小是 ${size}。`
}
}
// app.module.ts
@Module({
imports: [
KoishiModule.register({
templateParams: {
dress: {
commandName: 'dress',
color: '红色',
size: 'XL',
},
},
}),
],
providers: [
AppService,
],
})
export class AppModule {}
```
## 使用服务
您也可以在 NestJS 的提供者类中,使用 `@WireContextService()` 装饰器在 NestJS 提供者类中注入 Koishi 的服务对象。
```ts
@Injectable()
export class AppService implements OnApplicationBootstrap {
// 注入服务对象
@WireContextService('cache')
private database: DatabaseService
// 成员变量名与服务名称一致时 name 可省略。
@WireContextService()
private database2: DatabaseService
async onApplicationBootstrap() {
// onApplicationBootstrap 钩子方法中,插件已经加载完毕,因此在这里可以确保能访问服务对象
const user = await this.database.getUser('114514')
}
}
```
......@@ -14,7 +14,7 @@
"@types/ws": "^8.5.3",
"koa": "^2.13.4",
"koa-bodyparser": "^4.3.0",
"koishi-thirdeye": "^11.1.14",
"koishi-thirdeye": "^11.1.19",
"lodash": "^4.17.21",
"typed-reflector": "^1.0.11",
"ws": "^8.7.0"
......@@ -46,7 +46,7 @@
"peerDependencies": {
"@nestjs/common": "^9.0.3 || ^8.0.0",
"@nestjs/core": "^9.0.3 || ^8.0.0",
"koishi": "^4.10.4",
"koishi": "^4.10.10",
"rxjs": "^7.5.5"
}
},
......@@ -1243,37 +1243,37 @@
}
},
"node_modules/@koishijs/core": {
"version": "4.10.4",
"resolved": "https://registry.npmjs.org/@koishijs/core/-/core-4.10.4.tgz",
"integrity": "sha512-uhR2RoslHs3ynhElWP+jIwzqn8PprlPGF10qWQvTpW1l5XmPr+PiWgf5HmAGt1XucWcuij9n1Z179yqZs6xLNg==",
"version": "4.10.10",
"resolved": "https://registry.npmjs.org/@koishijs/core/-/core-4.10.10.tgz",
"integrity": "sha512-LooBZCQSm91TL7aBBECjaFaROn+udCAavOwi+AWzbFPBfcuF4ZHFGpQ112yWK70xbQ7YhHUueueqJpkAGOy4RA==",
"peer": true,
"dependencies": {
"@koishijs/utils": "^6.2.6",
"@minatojs/core": "^2.0.1",
"@satorijs/core": "^1.4.3",
"@koishijs/utils": "^6.3.4",
"@minatojs/core": "^2.0.3",
"@satorijs/core": "^1.4.11",
"cordis": "^2.6.0",
"cosmokit": "^1.3.3",
"cosmokit": "^1.3.6",
"fastest-levenshtein": "^1.0.16"
}
},
"node_modules/@koishijs/utils": {
"version": "6.2.6",
"resolved": "https://registry.npmjs.org/@koishijs/utils/-/utils-6.2.6.tgz",
"integrity": "sha512-JAqzAmTLwLwd4LHRoLjMvCojHeyDiGaKqgpd7p3/PMeXL7aHtN+owPv0xtn9jB375llGHYQT51PMkiLMbAIpYw==",
"version": "6.3.4",
"resolved": "https://registry.npmjs.org/@koishijs/utils/-/utils-6.3.4.tgz",
"integrity": "sha512-P8hQOTVYsk5rCkBcYbIKKKBm58etGlY/Q3xOuMEyz6BlTe0V8A6lFv56nInuPIaTOf4XprTceZBE6Oe3lC8RuQ==",
"peer": true,
"dependencies": {
"cosmokit": "^1.3.3",
"cosmokit": "^1.3.6",
"inaba": "^1.1.1",
"reggol": "^1.3.2",
"schemastery": "^3.5.4"
"reggol": "^1.3.3",
"schemastery": "^3.6.1"
}
},
"node_modules/@minatojs/core": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/@minatojs/core/-/core-2.0.1.tgz",
"integrity": "sha512-li7js0EZGw3PV28VM9B/aBX2QeKwvk32U4Haf4uvq0iBTH7L4JRq4YbOqlO5ZjrExoZS4RHBZtz4wzfW3Ay3jw==",
"version": "2.0.3",
"resolved": "https://registry.npmjs.org/@minatojs/core/-/core-2.0.3.tgz",
"integrity": "sha512-VZo1sDl9jLcejMyEfd/A+yZt/qre3vB+woSIZmWCm78zBR+CkFPk56y5EAMnu0cW9kgtq0p/KHa2VUVXyN71Bw==",
"dependencies": {
"cosmokit": "^1.3.3"
"cosmokit": "^1.3.4"
}
},
"node_modules/@nestjs/common": {
......@@ -1543,48 +1543,48 @@
}
},
"node_modules/@satorijs/core": {
"version": "1.4.3",
"resolved": "https://registry.npmjs.org/@satorijs/core/-/core-1.4.3.tgz",
"integrity": "sha512-L0VJVq3jlb8r4IaYlNBMfh4A3vskDMeQwl9Y5lgXBlShxsMzn2XcgtDKfa4WgNH4HzRFjS8iLkVBSo9jDW+3TA==",
"version": "1.4.11",
"resolved": "https://registry.npmjs.org/@satorijs/core/-/core-1.4.11.tgz",
"integrity": "sha512-8EsVA5esShEqYMwwXipGwx7obwVb3Lc0NwBmjZWNj2++WYKYg+jQ0Iatgd2jcJhNX2H9ziqnwu05aHtWo+mSsA==",
"peer": true,
"dependencies": {
"@satorijs/element": "^2.1.7",
"@satorijs/element": "^2.2.2",
"cordis": "^2.6.0",
"cordis-axios": "^2.1.5",
"cosmokit": "^1.3.3",
"reggol": "^1.3.2",
"schemastery": "^3.5.4",
"cordis-axios": "^2.1.6",
"cosmokit": "^1.3.6",
"reggol": "^1.3.3",
"schemastery": "^3.6.1",
"ws": "^8.11.0"
}
},
"node_modules/@satorijs/element": {
"version": "2.1.8",
"resolved": "https://registry.npmjs.org/@satorijs/element/-/element-2.1.8.tgz",
"integrity": "sha512-a1/ClyPKJQdv07RgUANdOahULTiJE7H7TRaP6w6d+DB46rh9KAvZyhp3tDgMBKBm/3bOvfpieXWExgDdQVgsBA==",
"version": "2.2.2",
"resolved": "https://registry.npmjs.org/@satorijs/element/-/element-2.2.2.tgz",
"integrity": "sha512-t6K0weO+GwqHhP/C9GTchck0jDk8c63kiAr9hHEVQX3nx/+fjGquTDGzBc4WzOVc105wePWRvV1UtvRaa0I9FQ==",
"peer": true,
"dependencies": {
"cosmokit": "^1.3.3"
"cosmokit": "^1.3.6"
}
},
"node_modules/@satorijs/satori": {
"version": "1.4.3",
"resolved": "https://registry.npmjs.org/@satorijs/satori/-/satori-1.4.3.tgz",
"integrity": "sha512-XgMolxa9/9gWf4+VKqLioBkzuZA0QXQIMWZHFET1dVvQjbxNhaETF0NBmwFSjbVBOWvTN8vecTGTSLc3pQn+Rw==",
"version": "1.4.11",
"resolved": "https://registry.npmjs.org/@satorijs/satori/-/satori-1.4.11.tgz",
"integrity": "sha512-nQHch/Ya1ClsNO9anJYfNnpiMFHCc1ihxdWuVKKpGOXRxuGMOtnbkB/Qa+NuBT+887E2NsFfTBoFgt8vuExxew==",
"peer": true,
"dependencies": {
"@koa/router": "^10.1.1",
"@satorijs/core": "1.4.3",
"@satorijs/core": "1.4.11",
"@types/koa": "*",
"@types/koa__router": "*",
"@types/ws": "^8.5.3",
"agent-base": "^6.0.2",
"http-proxy-agent": "^5.0.0",
"https-proxy-agent": "^5.0.1",
"koa": "^2.13.4",
"koa": "^2.14.1",
"koa-bodyparser": "^4.3.0",
"parseurl": "^1.3.3",
"path-to-regexp": "^6.2.1",
"schemastery": "^3.5.4",
"schemastery": "^3.6.1",
"socks-proxy-agent": "^5.0.1",
"ws": "^8.11.0"
},
......@@ -2874,16 +2874,16 @@
}
},
"node_modules/cordis-axios": {
"version": "2.1.5",
"resolved": "https://registry.npmjs.org/cordis-axios/-/cordis-axios-2.1.5.tgz",
"integrity": "sha512-L5cHolNBlo4MxhfWRETpz1G20jF6J0Hu+5zPxebo0XJthqO0eI6U/2DrbQvXARnyMhuQIIZfoPJLvSNgd0Rjzw==",
"version": "2.1.6",
"resolved": "https://registry.npmjs.org/cordis-axios/-/cordis-axios-2.1.6.tgz",
"integrity": "sha512-GaJq5zoh4XRAFHEOyCLyU7kIcRrV7hqDVEh5kF4t047TmROAUaLukPKSMeMVMNohpKW4Vz+tj2FGEqMx5NuBQg==",
"peer": true,
"dependencies": {
"axios": "~1.1.3",
"cosmokit": "^1.3.3",
"cosmokit": "^1.3.4",
"file-type": "^16.5.4",
"mime-db": "^1.52.0",
"schemastery": "^3.5.4"
"schemastery": "^3.6.1"
},
"engines": {
"node": ">=12.0.0"
......@@ -2929,9 +2929,9 @@
}
},
"node_modules/cosmokit": {
"version": "1.3.3",
"resolved": "https://registry.npmjs.org/cosmokit/-/cosmokit-1.3.3.tgz",
"integrity": "sha512-jpEp5zDrGbycu8AdaCjmNNr2J617NAFvAU6GM8o/dJP2/pe80qTbPoflqyJzAuMhiaC6QCXlBP0KCusTsDemPQ=="
"version": "1.3.6",
"resolved": "https://registry.npmjs.org/cosmokit/-/cosmokit-1.3.6.tgz",
"integrity": "sha512-buZvC7fuqBbSimJfkaaTJmlelpgj56L7VybjNkCy5UVvShMVQHi/bTZcuBfYLBwpuebSfvDZPwwHS5IfcoAnxg=="
},
"node_modules/cross-spawn": {
"version": "7.0.3",
......@@ -5171,9 +5171,9 @@
}
},
"node_modules/koa": {
"version": "2.13.4",
"resolved": "https://registry.npmjs.org/koa/-/koa-2.13.4.tgz",
"integrity": "sha512-43zkIKubNbnrULWlHdN5h1g3SEKXOEzoAlRsHOTFpnlDu8JlAOZSMJBLULusuXRequboiwJcj5vtYXKB3k7+2g==",
"version": "2.14.1",
"resolved": "https://registry.npmjs.org/koa/-/koa-2.14.1.tgz",
"integrity": "sha512-USJFyZgi2l0wDgqkfD27gL4YGno7TfUkcmOe6UOLFOVuN+J7FwnNu4Dydl4CUQzraM1lBAiGed0M9OVJoT0Kqw==",
"dependencies": {
"accepts": "^1.3.5",
"cache-content-type": "^1.0.0",
......@@ -5264,14 +5264,14 @@
}
},
"node_modules/koishi": {
"version": "4.10.4",
"resolved": "https://registry.npmjs.org/koishi/-/koishi-4.10.4.tgz",
"integrity": "sha512-06ylHCmyyj8buQxPcnuSap7Yco6HtzC0o61AwBuBOikdILQj2WicexztohuLhQ/9ElA3pEOsJaHzDa/9Lh71Ng==",
"version": "4.10.10",
"resolved": "https://registry.npmjs.org/koishi/-/koishi-4.10.10.tgz",
"integrity": "sha512-92VxR/7AL8l2eyd0MOWi5Nc/nLe2lX9ftglsMkqHvvImFkQma+2kSuexuxVLjcDmkAL6LWI27VxyuUH35jl5PQ==",
"peer": true,
"dependencies": {
"@koishijs/core": "^4.10.4",
"@koishijs/utils": "^6.2.6",
"@satorijs/satori": "^1.4.3",
"@koishijs/core": "^4.10.10",
"@koishijs/utils": "^6.3.4",
"@satorijs/satori": "^1.4.11",
"file-type": "^16.5.4",
"ns-require": "^1.1.4"
},
......@@ -5280,16 +5280,16 @@
}
},
"node_modules/koishi-thirdeye": {
"version": "11.1.14",
"resolved": "https://registry.npmjs.org/koishi-thirdeye/-/koishi-thirdeye-11.1.14.tgz",
"integrity": "sha512-poQZwMfkiurvDMdEhfa0TnhRhe/7VNismNDo6xcZAZVUfDl4Q8USCYEVwlmUvi6GSWl4X+4a51YL3VUZQX+GrA==",
"version": "11.1.19",
"resolved": "https://registry.npmjs.org/koishi-thirdeye/-/koishi-thirdeye-11.1.19.tgz",
"integrity": "sha512-58Fu19ymaxbrELiOCSTxHVKvIuemfoLWzrgiXXgLxTiRh95VBhWSa+dVn8XOQEVxKvSFVYWzaKyYzu6k2uIoOw==",
"dependencies": {
"minato-decorators": "^2.2.1",
"rxjs": "^7.5.6",
"satori-decorators": "^1.1.1"
},
"peerDependencies": {
"koishi": "^4.10.4"
"koishi": "^4.10.10"
}
},
"node_modules/leven": {
......@@ -6287,12 +6287,12 @@
}
},
"node_modules/reggol": {
"version": "1.3.2",
"resolved": "https://registry.npmjs.org/reggol/-/reggol-1.3.2.tgz",
"integrity": "sha512-vI+nWzdBJlO9OsrDCJ/z5NS4/o1mzHjwrZcn6LoESHn2get7LrbZ0TZB/dEkCtUlah324rxd5E2zciT/98Op1Q==",
"version": "1.3.3",
"resolved": "https://registry.npmjs.org/reggol/-/reggol-1.3.3.tgz",
"integrity": "sha512-AmFo4aBBLwd1IosfkQ9cnWJF+RDXjrfmY2pFeRXSLlvi1UoqMYLsltR/514R8Dr/ZfAYdcD75V/vFDK60hgyOQ==",
"peer": true,
"dependencies": {
"cosmokit": "^1.3.3",
"cosmokit": "^1.3.6",
"object-inspect": "^1.12.2",
"supports-color": "^8.1.1"
}
......@@ -6522,12 +6522,12 @@
}
},
"node_modules/schemastery": {
"version": "3.5.4",
"resolved": "https://registry.npmjs.org/schemastery/-/schemastery-3.5.4.tgz",
"integrity": "sha512-YPr+tR4fFt/d1gH0AXQjlr+Luw5+3Hz75tWT8g8Iqt1wnNTys3+TB2wAaekrTKhgnWhQPCHwDfLF1KZHNTNquw==",
"version": "3.6.1",
"resolved": "https://registry.npmjs.org/schemastery/-/schemastery-3.6.1.tgz",
"integrity": "sha512-Igh4oqaHco1AYmqpSgYgg411gNomSI9xE35Xo/FuzJZTMYWA5W1o+82Q5qMnt9FAQ76gZig0pea9OcHl0AM/Lw==",
"peer": true,
"dependencies": {
"cosmokit": "^1.2.1"
"cosmokit": "^1.3.4"
}
},
"node_modules/schemastery-gen": {
......@@ -8505,37 +8505,37 @@
}
},
"@koishijs/core": {
"version": "4.10.4",
"resolved": "https://registry.npmjs.org/@koishijs/core/-/core-4.10.4.tgz",
"integrity": "sha512-uhR2RoslHs3ynhElWP+jIwzqn8PprlPGF10qWQvTpW1l5XmPr+PiWgf5HmAGt1XucWcuij9n1Z179yqZs6xLNg==",
"version": "4.10.10",
"resolved": "https://registry.npmjs.org/@koishijs/core/-/core-4.10.10.tgz",
"integrity": "sha512-LooBZCQSm91TL7aBBECjaFaROn+udCAavOwi+AWzbFPBfcuF4ZHFGpQ112yWK70xbQ7YhHUueueqJpkAGOy4RA==",
"peer": true,
"requires": {
"@koishijs/utils": "^6.2.6",
"@minatojs/core": "^2.0.1",
"@satorijs/core": "^1.4.3",
"@koishijs/utils": "^6.3.4",
"@minatojs/core": "^2.0.3",
"@satorijs/core": "^1.4.11",
"cordis": "^2.6.0",
"cosmokit": "^1.3.3",
"cosmokit": "^1.3.6",
"fastest-levenshtein": "^1.0.16"
}
},
"@koishijs/utils": {
"version": "6.2.6",
"resolved": "https://registry.npmjs.org/@koishijs/utils/-/utils-6.2.6.tgz",
"integrity": "sha512-JAqzAmTLwLwd4LHRoLjMvCojHeyDiGaKqgpd7p3/PMeXL7aHtN+owPv0xtn9jB375llGHYQT51PMkiLMbAIpYw==",
"version": "6.3.4",
"resolved": "https://registry.npmjs.org/@koishijs/utils/-/utils-6.3.4.tgz",
"integrity": "sha512-P8hQOTVYsk5rCkBcYbIKKKBm58etGlY/Q3xOuMEyz6BlTe0V8A6lFv56nInuPIaTOf4XprTceZBE6Oe3lC8RuQ==",
"peer": true,
"requires": {
"cosmokit": "^1.3.3",
"cosmokit": "^1.3.6",
"inaba": "^1.1.1",
"reggol": "^1.3.2",
"schemastery": "^3.5.4"
"reggol": "^1.3.3",
"schemastery": "^3.6.1"
}
},
"@minatojs/core": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/@minatojs/core/-/core-2.0.1.tgz",
"integrity": "sha512-li7js0EZGw3PV28VM9B/aBX2QeKwvk32U4Haf4uvq0iBTH7L4JRq4YbOqlO5ZjrExoZS4RHBZtz4wzfW3Ay3jw==",
"version": "2.0.3",
"resolved": "https://registry.npmjs.org/@minatojs/core/-/core-2.0.3.tgz",
"integrity": "sha512-VZo1sDl9jLcejMyEfd/A+yZt/qre3vB+woSIZmWCm78zBR+CkFPk56y5EAMnu0cW9kgtq0p/KHa2VUVXyN71Bw==",
"requires": {
"cosmokit": "^1.3.3"
"cosmokit": "^1.3.4"
}
},
"@nestjs/common": {
......@@ -8666,48 +8666,48 @@
}
},
"@satorijs/core": {
"version": "1.4.3",
"resolved": "https://registry.npmjs.org/@satorijs/core/-/core-1.4.3.tgz",
"integrity": "sha512-L0VJVq3jlb8r4IaYlNBMfh4A3vskDMeQwl9Y5lgXBlShxsMzn2XcgtDKfa4WgNH4HzRFjS8iLkVBSo9jDW+3TA==",
"version": "1.4.11",
"resolved": "https://registry.npmjs.org/@satorijs/core/-/core-1.4.11.tgz",
"integrity": "sha512-8EsVA5esShEqYMwwXipGwx7obwVb3Lc0NwBmjZWNj2++WYKYg+jQ0Iatgd2jcJhNX2H9ziqnwu05aHtWo+mSsA==",
"peer": true,
"requires": {
"@satorijs/element": "^2.1.7",
"@satorijs/element": "^2.2.2",
"cordis": "^2.6.0",
"cordis-axios": "^2.1.5",
"cosmokit": "^1.3.3",
"reggol": "^1.3.2",
"schemastery": "^3.5.4",
"cordis-axios": "^2.1.6",
"cosmokit": "^1.3.6",
"reggol": "^1.3.3",
"schemastery": "^3.6.1",
"ws": "^8.11.0"
}
},
"@satorijs/element": {
"version": "2.1.8",
"resolved": "https://registry.npmjs.org/@satorijs/element/-/element-2.1.8.tgz",
"integrity": "sha512-a1/ClyPKJQdv07RgUANdOahULTiJE7H7TRaP6w6d+DB46rh9KAvZyhp3tDgMBKBm/3bOvfpieXWExgDdQVgsBA==",
"version": "2.2.2",
"resolved": "https://registry.npmjs.org/@satorijs/element/-/element-2.2.2.tgz",
"integrity": "sha512-t6K0weO+GwqHhP/C9GTchck0jDk8c63kiAr9hHEVQX3nx/+fjGquTDGzBc4WzOVc105wePWRvV1UtvRaa0I9FQ==",
"peer": true,
"requires": {
"cosmokit": "^1.3.3"
"cosmokit": "^1.3.6"
}
},
"@satorijs/satori": {
"version": "1.4.3",
"resolved": "https://registry.npmjs.org/@satorijs/satori/-/satori-1.4.3.tgz",
"integrity": "sha512-XgMolxa9/9gWf4+VKqLioBkzuZA0QXQIMWZHFET1dVvQjbxNhaETF0NBmwFSjbVBOWvTN8vecTGTSLc3pQn+Rw==",
"version": "1.4.11",
"resolved": "https://registry.npmjs.org/@satorijs/satori/-/satori-1.4.11.tgz",
"integrity": "sha512-nQHch/Ya1ClsNO9anJYfNnpiMFHCc1ihxdWuVKKpGOXRxuGMOtnbkB/Qa+NuBT+887E2NsFfTBoFgt8vuExxew==",
"peer": true,
"requires": {
"@koa/router": "^10.1.1",
"@satorijs/core": "1.4.3",
"@satorijs/core": "1.4.11",
"@types/koa": "*",
"@types/koa__router": "*",
"@types/ws": "^8.5.3",
"agent-base": "^6.0.2",
"http-proxy-agent": "^5.0.0",
"https-proxy-agent": "^5.0.1",
"koa": "^2.13.4",
"koa": "^2.14.1",
"koa-bodyparser": "^4.3.0",
"parseurl": "^1.3.3",
"path-to-regexp": "^6.2.1",
"schemastery": "^3.5.4",
"schemastery": "^3.6.1",
"socks-proxy-agent": "^5.0.1",
"ws": "^8.11.0"
},
......@@ -9744,16 +9744,16 @@
}
},
"cordis-axios": {
"version": "2.1.5",
"resolved": "https://registry.npmjs.org/cordis-axios/-/cordis-axios-2.1.5.tgz",
"integrity": "sha512-L5cHolNBlo4MxhfWRETpz1G20jF6J0Hu+5zPxebo0XJthqO0eI6U/2DrbQvXARnyMhuQIIZfoPJLvSNgd0Rjzw==",
"version": "2.1.6",
"resolved": "https://registry.npmjs.org/cordis-axios/-/cordis-axios-2.1.6.tgz",
"integrity": "sha512-GaJq5zoh4XRAFHEOyCLyU7kIcRrV7hqDVEh5kF4t047TmROAUaLukPKSMeMVMNohpKW4Vz+tj2FGEqMx5NuBQg==",
"peer": true,
"requires": {
"axios": "~1.1.3",
"cosmokit": "^1.3.3",
"cosmokit": "^1.3.4",
"file-type": "^16.5.4",
"mime-db": "^1.52.0",
"schemastery": "^3.5.4"
"schemastery": "^3.6.1"
}
},
"cordis-decorators": {
......@@ -9786,9 +9786,9 @@
}
},
"cosmokit": {
"version": "1.3.3",
"resolved": "https://registry.npmjs.org/cosmokit/-/cosmokit-1.3.3.tgz",
"integrity": "sha512-jpEp5zDrGbycu8AdaCjmNNr2J617NAFvAU6GM8o/dJP2/pe80qTbPoflqyJzAuMhiaC6QCXlBP0KCusTsDemPQ=="
"version": "1.3.6",
"resolved": "https://registry.npmjs.org/cosmokit/-/cosmokit-1.3.6.tgz",
"integrity": "sha512-buZvC7fuqBbSimJfkaaTJmlelpgj56L7VybjNkCy5UVvShMVQHi/bTZcuBfYLBwpuebSfvDZPwwHS5IfcoAnxg=="
},
"cross-spawn": {
"version": "7.0.3",
......@@ -11484,9 +11484,9 @@
"dev": true
},
"koa": {
"version": "2.13.4",
"resolved": "https://registry.npmjs.org/koa/-/koa-2.13.4.tgz",
"integrity": "sha512-43zkIKubNbnrULWlHdN5h1g3SEKXOEzoAlRsHOTFpnlDu8JlAOZSMJBLULusuXRequboiwJcj5vtYXKB3k7+2g==",
"version": "2.14.1",
"resolved": "https://registry.npmjs.org/koa/-/koa-2.14.1.tgz",
"integrity": "sha512-USJFyZgi2l0wDgqkfD27gL4YGno7TfUkcmOe6UOLFOVuN+J7FwnNu4Dydl4CUQzraM1lBAiGed0M9OVJoT0Kqw==",
"requires": {
"accepts": "^1.3.5",
"cache-content-type": "^1.0.0",
......@@ -11563,22 +11563,22 @@
}
},
"koishi": {
"version": "4.10.4",
"resolved": "https://registry.npmjs.org/koishi/-/koishi-4.10.4.tgz",
"integrity": "sha512-06ylHCmyyj8buQxPcnuSap7Yco6HtzC0o61AwBuBOikdILQj2WicexztohuLhQ/9ElA3pEOsJaHzDa/9Lh71Ng==",
"version": "4.10.10",
"resolved": "https://registry.npmjs.org/koishi/-/koishi-4.10.10.tgz",
"integrity": "sha512-92VxR/7AL8l2eyd0MOWi5Nc/nLe2lX9ftglsMkqHvvImFkQma+2kSuexuxVLjcDmkAL6LWI27VxyuUH35jl5PQ==",
"peer": true,
"requires": {
"@koishijs/core": "^4.10.4",
"@koishijs/utils": "^6.2.6",
"@satorijs/satori": "^1.4.3",
"@koishijs/core": "^4.10.10",
"@koishijs/utils": "^6.3.4",
"@satorijs/satori": "^1.4.11",
"file-type": "^16.5.4",
"ns-require": "^1.1.4"
}
},
"koishi-thirdeye": {
"version": "11.1.14",
"resolved": "https://registry.npmjs.org/koishi-thirdeye/-/koishi-thirdeye-11.1.14.tgz",
"integrity": "sha512-poQZwMfkiurvDMdEhfa0TnhRhe/7VNismNDo6xcZAZVUfDl4Q8USCYEVwlmUvi6GSWl4X+4a51YL3VUZQX+GrA==",
"version": "11.1.19",
"resolved": "https://registry.npmjs.org/koishi-thirdeye/-/koishi-thirdeye-11.1.19.tgz",
"integrity": "sha512-58Fu19ymaxbrELiOCSTxHVKvIuemfoLWzrgiXXgLxTiRh95VBhWSa+dVn8XOQEVxKvSFVYWzaKyYzu6k2uIoOw==",
"requires": {
"minato-decorators": "^2.2.1",
"rxjs": "^7.5.6",
......@@ -12348,12 +12348,12 @@
"dev": true
},
"reggol": {
"version": "1.3.2",
"resolved": "https://registry.npmjs.org/reggol/-/reggol-1.3.2.tgz",
"integrity": "sha512-vI+nWzdBJlO9OsrDCJ/z5NS4/o1mzHjwrZcn6LoESHn2get7LrbZ0TZB/dEkCtUlah324rxd5E2zciT/98Op1Q==",
"version": "1.3.3",
"resolved": "https://registry.npmjs.org/reggol/-/reggol-1.3.3.tgz",
"integrity": "sha512-AmFo4aBBLwd1IosfkQ9cnWJF+RDXjrfmY2pFeRXSLlvi1UoqMYLsltR/514R8Dr/ZfAYdcD75V/vFDK60hgyOQ==",
"peer": true,
"requires": {
"cosmokit": "^1.3.3",
"cosmokit": "^1.3.6",
"object-inspect": "^1.12.2",
"supports-color": "^8.1.1"
},
......@@ -12512,12 +12512,12 @@
}
},
"schemastery": {
"version": "3.5.4",
"resolved": "https://registry.npmjs.org/schemastery/-/schemastery-3.5.4.tgz",
"integrity": "sha512-YPr+tR4fFt/d1gH0AXQjlr+Luw5+3Hz75tWT8g8Iqt1wnNTys3+TB2wAaekrTKhgnWhQPCHwDfLF1KZHNTNquw==",
"version": "3.6.1",
"resolved": "https://registry.npmjs.org/schemastery/-/schemastery-3.6.1.tgz",
"integrity": "sha512-Igh4oqaHco1AYmqpSgYgg411gNomSI9xE35Xo/FuzJZTMYWA5W1o+82Q5qMnt9FAQ76gZig0pea9OcHl0AM/Lw==",
"peer": true,
"requires": {
"cosmokit": "^1.2.1"
"cosmokit": "^1.3.4"
}
},
"schemastery-gen": {
......
......@@ -33,7 +33,7 @@
"peerDependencies": {
"@nestjs/common": "^9.0.3 || ^8.0.0",
"@nestjs/core": "^9.0.3 || ^8.0.0",
"koishi": "^4.10.4",
"koishi": "^4.10.10",
"rxjs": "^7.5.5"
},
"devDependencies": {
......@@ -66,7 +66,7 @@
"@types/ws": "^8.5.3",
"koa": "^2.13.4",
"koa-bodyparser": "^4.3.0",
"koishi-thirdeye": "^11.1.14",
"koishi-thirdeye": "^11.1.19",
"lodash": "^4.17.21",
"typed-reflector": "^1.0.11",
"ws": "^8.7.0"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment