Commit 0201e1f3 authored by nanahira's avatar nanahira

adapt

parent 68f0ab1b
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
"version": "0.0.1", "version": "0.0.1",
"license": "UNLICENSED", "license": "UNLICENSED",
"dependencies": { "dependencies": {
"@koishijs/plugin-adapter-onebot": "^4.0.0-alpha.10", "@koishijs/plugin-adapter-onebot": "^4.0.0-beta.0",
"@nestjs/common": "^8.0.0", "@nestjs/common": "^8.0.0",
"@nestjs/config": "^1.0.3", "@nestjs/config": "^1.0.3",
"@nestjs/core": "^8.0.0", "@nestjs/core": "^8.0.0",
...@@ -18,8 +18,8 @@ ...@@ -18,8 +18,8 @@
"@nestjs/websockets": "^8.1.2", "@nestjs/websockets": "^8.1.2",
"class-transformer": "^0.4.0", "class-transformer": "^0.4.0",
"class-validator": "^0.13.1", "class-validator": "^0.13.1",
"koishi": "^4.0.0-alpha.12", "koishi": "^4.0.0-beta.0",
"koishi-nestjs": "^1.4.2", "koishi-nestjs": "^2.0.0",
"reflect-metadata": "^0.1.13", "reflect-metadata": "^0.1.13",
"rimraf": "^3.0.2", "rimraf": "^3.0.2",
"rxjs": "^7.2.0", "rxjs": "^7.2.0",
...@@ -1348,11 +1348,11 @@ ...@@ -1348,11 +1348,11 @@
"integrity": "sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw==" "integrity": "sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw=="
}, },
"node_modules/@koishijs/core": { "node_modules/@koishijs/core": {
"version": "4.0.0-alpha.11", "version": "4.0.0-beta.0",
"resolved": "https://registry.npmjs.org/@koishijs/core/-/core-4.0.0-alpha.11.tgz", "resolved": "https://registry.npmjs.org/@koishijs/core/-/core-4.0.0-beta.0.tgz",
"integrity": "sha512-nN9NJi83/vcfX0w20C1CulBMImhAgrts7YwYPivHDKORq7zq+c76fVPVx5IoTsmavqGpaQ75hHDlua70ZOl7BA==", "integrity": "sha512-G40ePYqygU5BUxW62CuqrHF9cK8qfX3Vjcc0k4r92rnGAN6qyxhQY8LMx7ZMBpZmk91x0J+FY7C6KuSIu7smJQ==",
"dependencies": { "dependencies": {
"@koishijs/utils": "^5.0.0-alpha.7", "@koishijs/utils": "^5.0.0-beta.0",
"fastest-levenshtein": "^1.0.12" "fastest-levenshtein": "^1.0.12"
}, },
"engines": { "engines": {
...@@ -1360,15 +1360,15 @@ ...@@ -1360,15 +1360,15 @@
} }
}, },
"node_modules/@koishijs/plugin-adapter-onebot": { "node_modules/@koishijs/plugin-adapter-onebot": {
"version": "4.0.0-alpha.10", "version": "4.0.0-beta.0",
"resolved": "https://registry.npmjs.org/@koishijs/plugin-adapter-onebot/-/plugin-adapter-onebot-4.0.0-alpha.10.tgz", "resolved": "https://registry.npmjs.org/@koishijs/plugin-adapter-onebot/-/plugin-adapter-onebot-4.0.0-beta.0.tgz",
"integrity": "sha512-aNjewdjr7Q+aB1Ii/osI3fI4jp7VHhVHF3p3XlGfFj4bpvfTHDzUxWhrjnyxhHhTdokrxUAaUoIuFEZR6WxC0Q==", "integrity": "sha512-u7JshUzn8yRZBQxEoW0FwkwfNM5oWBXdLK+wd9DEWcCZ5hXr3L0XWrhsT2srNcFLOGd3waQD8BBNGQ6MGbRUrQ==",
"dependencies": { "dependencies": {
"qface": "^1.2.0", "qface": "^1.2.0",
"ws": "^8.2.1" "ws": "^8.2.1"
}, },
"peerDependencies": { "peerDependencies": {
"koishi": "^4.0.0-alpha.12" "koishi": "^4.0.0-beta.0"
} }
}, },
"node_modules/@koishijs/plugin-adapter-onebot/node_modules/ws": { "node_modules/@koishijs/plugin-adapter-onebot/node_modules/ws": {
...@@ -1392,20 +1392,20 @@ ...@@ -1392,20 +1392,20 @@
} }
}, },
"node_modules/@koishijs/plugin-cache-lru": { "node_modules/@koishijs/plugin-cache-lru": {
"version": "1.0.0-alpha.2", "version": "1.0.0-beta.0",
"resolved": "https://registry.npmjs.org/@koishijs/plugin-cache-lru/-/plugin-cache-lru-1.0.0-alpha.2.tgz", "resolved": "https://registry.npmjs.org/@koishijs/plugin-cache-lru/-/plugin-cache-lru-1.0.0-beta.0.tgz",
"integrity": "sha512-OthEMPDLEvFeJ7KPj8Wv/FlZUzAhDUMxb8rSZhZdLlLfSavK7q0HcjiTxCdLgmv7Er7Qg5Zb14YFH6ym9XIe3Q==", "integrity": "sha512-YhsF2FeBs8/LhGy3VO9pe5JkLAXJ6O40fyoppqLbM99B5ywUavJ4UG/0WidiyQrYZQoz0oB0YWFKEt/Xkn/e/g==",
"dependencies": { "dependencies": {
"lru-cache": "^6.0.0" "lru-cache": "^6.0.0"
}, },
"peerDependencies": { "peerDependencies": {
"koishi": "^4.0.0-alpha.12" "koishi": "^4.0.0-beta.0"
} }
}, },
"node_modules/@koishijs/utils": { "node_modules/@koishijs/utils": {
"version": "5.0.0-alpha.7", "version": "5.0.0-beta.0",
"resolved": "https://registry.npmjs.org/@koishijs/utils/-/utils-5.0.0-alpha.7.tgz", "resolved": "https://registry.npmjs.org/@koishijs/utils/-/utils-5.0.0-beta.0.tgz",
"integrity": "sha512-+1kwdQVq5raRZT/5vgWtBPj1PidtDHXmvP2ksIFikW7qSquddpgopQN4l0IfbjJGOz+Bb8oYGcyqLjQf+FpQRQ==", "integrity": "sha512-/FsfumbtI1rMRqZ2djzAgdVGFg3KFrF6ATvqhgsDf3y3EMWY7bs/y9VkpNNMPf+wk//+kBSALk5+xp7XcszqNQ==",
"dependencies": { "dependencies": {
"supports-color": "^8.1.0" "supports-color": "^8.1.0"
} }
...@@ -6878,14 +6878,14 @@ ...@@ -6878,14 +6878,14 @@
} }
}, },
"node_modules/koishi": { "node_modules/koishi": {
"version": "4.0.0-alpha.12", "version": "4.0.0-beta.0",
"resolved": "https://registry.npmjs.org/koishi/-/koishi-4.0.0-alpha.12.tgz", "resolved": "https://registry.npmjs.org/koishi/-/koishi-4.0.0-beta.0.tgz",
"integrity": "sha512-MT2avgFNrjScgAZhTVbmxZHQ38y6Vs3ibJ2nDuopfl04D9+GTRSoeUiBIxJXOFjauUkLGpJRaSrlX8uOatHFOA==", "integrity": "sha512-WtQ2oMREo/ZJKDceSDhz4X15EHJM9O9yXzDZaihchdRJUa95xkt5rVN1RwtRlLdBcahLbZdHyfgmArEuyR8kUw==",
"dependencies": { "dependencies": {
"@koa/router": "^10.1.1", "@koa/router": "^10.1.1",
"@koishijs/core": "^4.0.0-alpha.11", "@koishijs/core": "^4.0.0-beta.0",
"@koishijs/plugin-cache-lru": "^1.0.0-alpha.2", "@koishijs/plugin-cache-lru": "^1.0.0-beta.0",
"@koishijs/utils": "^5.0.0-alpha.7", "@koishijs/utils": "^5.0.0-beta.0",
"@types/koa": "*", "@types/koa": "*",
"@types/koa__router": "*", "@types/koa__router": "*",
"@types/ws": "^7.4.7", "@types/ws": "^7.4.7",
...@@ -6901,9 +6901,9 @@ ...@@ -6901,9 +6901,9 @@
} }
}, },
"node_modules/koishi-nestjs": { "node_modules/koishi-nestjs": {
"version": "1.4.2", "version": "2.0.0",
"resolved": "https://registry.npmjs.org/koishi-nestjs/-/koishi-nestjs-1.4.2.tgz", "resolved": "https://registry.npmjs.org/koishi-nestjs/-/koishi-nestjs-2.0.0.tgz",
"integrity": "sha512-oHl3RTcP6DOrCF1ePocN/XPVHgwq4vBOFNUL9QNSauL24C1g0xsHbEfQUT2p4Z2vFo6eLc/T2zCnGPNJYi8SDQ==", "integrity": "sha512-SbQWkp+bbTPRFYCf8pVJdJMTyMocigXIRcN+gvCfhRUe3Y4IUcU8TwPIVZZgwoD3j9tNFvG+XDlq1wUcAA5bQg==",
"dependencies": { "dependencies": {
"@nestjs/platform-ws": "^8.1.2", "@nestjs/platform-ws": "^8.1.2",
"@nestjs/websockets": "^8.1.2", "@nestjs/websockets": "^8.1.2",
...@@ -6916,7 +6916,7 @@ ...@@ -6916,7 +6916,7 @@
"peerDependencies": { "peerDependencies": {
"@nestjs/common": "^8.0.0", "@nestjs/common": "^8.0.0",
"@nestjs/core": "^8.0.0", "@nestjs/core": "^8.0.0",
"koishi": "^4.0.0-alpha.12", "koishi": "^4.0.0-beta.0",
"reflect-metadata": "^0.1.13", "reflect-metadata": "^0.1.13",
"rxjs": "^7.4.0" "rxjs": "^7.4.0"
} }
...@@ -10909,18 +10909,18 @@ ...@@ -10909,18 +10909,18 @@
} }
}, },
"@koishijs/core": { "@koishijs/core": {
"version": "4.0.0-alpha.11", "version": "4.0.0-beta.0",
"resolved": "https://registry.npmjs.org/@koishijs/core/-/core-4.0.0-alpha.11.tgz", "resolved": "https://registry.npmjs.org/@koishijs/core/-/core-4.0.0-beta.0.tgz",
"integrity": "sha512-nN9NJi83/vcfX0w20C1CulBMImhAgrts7YwYPivHDKORq7zq+c76fVPVx5IoTsmavqGpaQ75hHDlua70ZOl7BA==", "integrity": "sha512-G40ePYqygU5BUxW62CuqrHF9cK8qfX3Vjcc0k4r92rnGAN6qyxhQY8LMx7ZMBpZmk91x0J+FY7C6KuSIu7smJQ==",
"requires": { "requires": {
"@koishijs/utils": "^5.0.0-alpha.7", "@koishijs/utils": "^5.0.0-beta.0",
"fastest-levenshtein": "^1.0.12" "fastest-levenshtein": "^1.0.12"
} }
}, },
"@koishijs/plugin-adapter-onebot": { "@koishijs/plugin-adapter-onebot": {
"version": "4.0.0-alpha.10", "version": "4.0.0-beta.0",
"resolved": "https://registry.npmjs.org/@koishijs/plugin-adapter-onebot/-/plugin-adapter-onebot-4.0.0-alpha.10.tgz", "resolved": "https://registry.npmjs.org/@koishijs/plugin-adapter-onebot/-/plugin-adapter-onebot-4.0.0-beta.0.tgz",
"integrity": "sha512-aNjewdjr7Q+aB1Ii/osI3fI4jp7VHhVHF3p3XlGfFj4bpvfTHDzUxWhrjnyxhHhTdokrxUAaUoIuFEZR6WxC0Q==", "integrity": "sha512-u7JshUzn8yRZBQxEoW0FwkwfNM5oWBXdLK+wd9DEWcCZ5hXr3L0XWrhsT2srNcFLOGd3waQD8BBNGQ6MGbRUrQ==",
"requires": { "requires": {
"qface": "^1.2.0", "qface": "^1.2.0",
"ws": "^8.2.1" "ws": "^8.2.1"
...@@ -10935,17 +10935,17 @@ ...@@ -10935,17 +10935,17 @@
} }
}, },
"@koishijs/plugin-cache-lru": { "@koishijs/plugin-cache-lru": {
"version": "1.0.0-alpha.2", "version": "1.0.0-beta.0",
"resolved": "https://registry.npmjs.org/@koishijs/plugin-cache-lru/-/plugin-cache-lru-1.0.0-alpha.2.tgz", "resolved": "https://registry.npmjs.org/@koishijs/plugin-cache-lru/-/plugin-cache-lru-1.0.0-beta.0.tgz",
"integrity": "sha512-OthEMPDLEvFeJ7KPj8Wv/FlZUzAhDUMxb8rSZhZdLlLfSavK7q0HcjiTxCdLgmv7Er7Qg5Zb14YFH6ym9XIe3Q==", "integrity": "sha512-YhsF2FeBs8/LhGy3VO9pe5JkLAXJ6O40fyoppqLbM99B5ywUavJ4UG/0WidiyQrYZQoz0oB0YWFKEt/Xkn/e/g==",
"requires": { "requires": {
"lru-cache": "^6.0.0" "lru-cache": "^6.0.0"
} }
}, },
"@koishijs/utils": { "@koishijs/utils": {
"version": "5.0.0-alpha.7", "version": "5.0.0-beta.0",
"resolved": "https://registry.npmjs.org/@koishijs/utils/-/utils-5.0.0-alpha.7.tgz", "resolved": "https://registry.npmjs.org/@koishijs/utils/-/utils-5.0.0-beta.0.tgz",
"integrity": "sha512-+1kwdQVq5raRZT/5vgWtBPj1PidtDHXmvP2ksIFikW7qSquddpgopQN4l0IfbjJGOz+Bb8oYGcyqLjQf+FpQRQ==", "integrity": "sha512-/FsfumbtI1rMRqZ2djzAgdVGFg3KFrF6ATvqhgsDf3y3EMWY7bs/y9VkpNNMPf+wk//+kBSALk5+xp7XcszqNQ==",
"requires": { "requires": {
"supports-color": "^8.1.0" "supports-color": "^8.1.0"
}, },
...@@ -15125,14 +15125,14 @@ ...@@ -15125,14 +15125,14 @@
} }
}, },
"koishi": { "koishi": {
"version": "4.0.0-alpha.12", "version": "4.0.0-beta.0",
"resolved": "https://registry.npmjs.org/koishi/-/koishi-4.0.0-alpha.12.tgz", "resolved": "https://registry.npmjs.org/koishi/-/koishi-4.0.0-beta.0.tgz",
"integrity": "sha512-MT2avgFNrjScgAZhTVbmxZHQ38y6Vs3ibJ2nDuopfl04D9+GTRSoeUiBIxJXOFjauUkLGpJRaSrlX8uOatHFOA==", "integrity": "sha512-WtQ2oMREo/ZJKDceSDhz4X15EHJM9O9yXzDZaihchdRJUa95xkt5rVN1RwtRlLdBcahLbZdHyfgmArEuyR8kUw==",
"requires": { "requires": {
"@koa/router": "^10.1.1", "@koa/router": "^10.1.1",
"@koishijs/core": "^4.0.0-alpha.11", "@koishijs/core": "^4.0.0-beta.0",
"@koishijs/plugin-cache-lru": "^1.0.0-alpha.2", "@koishijs/plugin-cache-lru": "^1.0.0-beta.0",
"@koishijs/utils": "^5.0.0-alpha.7", "@koishijs/utils": "^5.0.0-beta.0",
"@types/koa": "*", "@types/koa": "*",
"@types/koa__router": "*", "@types/koa__router": "*",
"@types/ws": "^7.4.7", "@types/ws": "^7.4.7",
...@@ -15160,9 +15160,9 @@ ...@@ -15160,9 +15160,9 @@
} }
}, },
"koishi-nestjs": { "koishi-nestjs": {
"version": "1.4.2", "version": "2.0.0",
"resolved": "https://registry.npmjs.org/koishi-nestjs/-/koishi-nestjs-1.4.2.tgz", "resolved": "https://registry.npmjs.org/koishi-nestjs/-/koishi-nestjs-2.0.0.tgz",
"integrity": "sha512-oHl3RTcP6DOrCF1ePocN/XPVHgwq4vBOFNUL9QNSauL24C1g0xsHbEfQUT2p4Z2vFo6eLc/T2zCnGPNJYi8SDQ==", "integrity": "sha512-SbQWkp+bbTPRFYCf8pVJdJMTyMocigXIRcN+gvCfhRUe3Y4IUcU8TwPIVZZgwoD3j9tNFvG+XDlq1wUcAA5bQg==",
"requires": { "requires": {
"@nestjs/platform-ws": "^8.1.2", "@nestjs/platform-ws": "^8.1.2",
"@nestjs/websockets": "^8.1.2", "@nestjs/websockets": "^8.1.2",
......
...@@ -21,7 +21,7 @@ ...@@ -21,7 +21,7 @@
"test:e2e": "jest --config ./test/jest-e2e.json" "test:e2e": "jest --config ./test/jest-e2e.json"
}, },
"dependencies": { "dependencies": {
"@koishijs/plugin-adapter-onebot": "^4.0.0-alpha.10", "@koishijs/plugin-adapter-onebot": "^4.0.0-beta.0",
"@nestjs/common": "^8.0.0", "@nestjs/common": "^8.0.0",
"@nestjs/config": "^1.0.3", "@nestjs/config": "^1.0.3",
"@nestjs/core": "^8.0.0", "@nestjs/core": "^8.0.0",
...@@ -30,8 +30,8 @@ ...@@ -30,8 +30,8 @@
"@nestjs/websockets": "^8.1.2", "@nestjs/websockets": "^8.1.2",
"class-transformer": "^0.4.0", "class-transformer": "^0.4.0",
"class-validator": "^0.13.1", "class-validator": "^0.13.1",
"koishi": "^4.0.0-alpha.12", "koishi": "^4.0.0-beta.0",
"koishi-nestjs": "^1.4.2", "koishi-nestjs": "^2.0.0",
"reflect-metadata": "^0.1.13", "reflect-metadata": "^0.1.13",
"rimraf": "^3.0.2", "rimraf": "^3.0.2",
"rxjs": "^7.2.0", "rxjs": "^7.2.0",
......
...@@ -14,7 +14,7 @@ Adapter.prototype.dispatch = function (this: Adapter, session: Session) { ...@@ -14,7 +14,7 @@ Adapter.prototype.dispatch = function (this: Adapter, session: Session) {
this.ctx.emit(session, 'dispatch', session); this.ctx.emit(session, 'dispatch', session);
}; };
import * as PluginOnebot from '@koishijs/plugin-adapter-onebot'; import PluginOnebot from '@koishijs/plugin-adapter-onebot';
import { ConfigService } from '@nestjs/config'; import { ConfigService } from '@nestjs/config';
import { InjectContext, PluginDef, UsePlugin } from 'koishi-nestjs'; import { InjectContext, PluginDef, UsePlugin } from 'koishi-nestjs';
import { BotConfig } from '@koishijs/plugin-adapter-onebot/lib/bot'; import { BotConfig } from '@koishijs/plugin-adapter-onebot/lib/bot';
......
...@@ -3,24 +3,24 @@ import { NestExpressApplication } from '@nestjs/platform-express'; ...@@ -3,24 +3,24 @@ import { NestExpressApplication } from '@nestjs/platform-express';
import { AppModule } from './app.module'; import { AppModule } from './app.module';
import { KoishiWsAdapter } from 'koishi-nestjs'; import { KoishiWsAdapter } from 'koishi-nestjs';
import { ConfigService } from '@nestjs/config'; import { ConfigService } from '@nestjs/config';
import { DocumentBuilder, SwaggerModule } from '@nestjs/swagger';
async function bootstrap() { async function bootstrap() {
const app = await NestFactory.create<NestExpressApplication>(AppModule); const app = await NestFactory.create<NestExpressApplication>(AppModule);
app.useWebSocketAdapter(new KoishiWsAdapter(app)); app.useWebSocketAdapter(new KoishiWsAdapter(app));
/*
app.enableCors(); app.enableCors();
app.set('trust proxy', ['172.16.0.0/12', 'loopback']); app.set('trust proxy', ['172.16.0.0/12', 'loopback']);
const documentConfig = new DocumentBuilder() const documentConfig = new DocumentBuilder()
.setTitle('app') .setTitle('onebot-lb')
.setDescription('The app') .setDescription('OneBot 负载均衡器')
.setVersion('1.0') .setVersion('1.1')
.build(); .build();
const document = SwaggerModule.createDocument(app, documentConfig); const document = SwaggerModule.createDocument(app, documentConfig);
SwaggerModule.setup('docs', app, document); SwaggerModule.setup('docs', app, document);
*/
const config = app.get(ConfigService); const config = app.get(ConfigService);
await app.listen( await app.listen(
config.get<number>('port') || 3000, config.get<number>('port') || 3000,
......
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