diff --git a/packages/core/src/index.ts b/packages/core/src/index.ts index 397526cd..7d0e4fd7 100644 --- a/packages/core/src/index.ts +++ b/packages/core/src/index.ts @@ -34,6 +34,7 @@ declare module 'cordis-axios' { defineProperty(Quester, 'Config', Schema.object({ timeout: Schema.natural().role('ms').description('等待连接建立的最长时间。'), + proxyAgent: Schema.string().description('使用的代理服务器地址。'), }).description('请求设置')) Quester.createConfig = function createConfig(this, endpoint) { @@ -107,7 +108,7 @@ export class Context extends cordis.Context { // remove generic type to loosen the constraint static readonly Session = Session as new (bot: Bot, event: Partial) => Session - public bots = new Proxy([] as Bot[] & Dict>, { + public bots = new Proxy([], { get(target, prop) { if (prop in target || typeof prop === 'symbol') { return Reflect.get(target, prop) @@ -123,7 +124,7 @@ export class Context extends cordis.Context { target.splice(bot, 1) return true }, - }) + }) as Bot[] & Dict> constructor(config: Context.Config = {}) { super(config) diff --git a/packages/satori/src/index.ts b/packages/satori/src/index.ts index e5722e25..15581b81 100644 --- a/packages/satori/src/index.ts +++ b/packages/satori/src/index.ts @@ -1,5 +1,5 @@ -import { Quester, Schema } from '@satorijs/core' -import { base64ToArrayBuffer, defineProperty } from 'cosmokit' +import { Quester } from '@satorijs/core' +import { base64ToArrayBuffer } from 'cosmokit' import { ClientRequestArgs } from 'http' import { WebSocket } from 'ws' import { basename } from 'path' @@ -50,11 +50,6 @@ Quester.prototype.prepare = function prepare(this: Quester) { return options } -defineProperty(Quester, 'Config', Schema.object({ - ...Quester.Config.dict, - proxyAgent: Schema.string().description('使用的代理服务器地址。'), -}).description('请求设置')) - Quester.defineAgent(['http'], createHttpProxyAgent) Quester.defineAgent(['https'], createHttpsProxyAgent) Quester.defineAgent(['socks', 'socks4', 'socks4a', 'socks5', 'socks5h'], createSocksProxyAgent)