mirror of
https://github.com/tiramisulabs/seyfert.git
synced 2025-07-01 20:46:08 +00:00
fix: reuse proxy
This commit is contained in:
parent
d8bf40b60c
commit
fcd9ffd34d
@ -1,5 +1,5 @@
|
|||||||
import { join } from 'node:path';
|
import { join } from 'node:path';
|
||||||
import { ApiHandler, Router } from '../api';
|
import { ApiHandler, Router, type APIRoutes } from '../api';
|
||||||
import type { Adapter } from '../cache';
|
import type { Adapter } from '../cache';
|
||||||
import { Cache, MemoryAdapter } from '../cache';
|
import { Cache, MemoryAdapter } from '../cache';
|
||||||
import type {
|
import type {
|
||||||
@ -57,6 +57,7 @@ import type { MessageStructure } from './transformers';
|
|||||||
|
|
||||||
export class BaseClient {
|
export class BaseClient {
|
||||||
rest!: ApiHandler;
|
rest!: ApiHandler;
|
||||||
|
proxy!: APIRoutes;
|
||||||
cache!: Cache;
|
cache!: Cache;
|
||||||
|
|
||||||
applications = new ApplicationShorter(this);
|
applications = new ApplicationShorter(this);
|
||||||
@ -184,13 +185,10 @@ export class BaseClient {
|
|||||||
return this._applicationId ?? this.botId;
|
return this._applicationId ?? this.botId;
|
||||||
}
|
}
|
||||||
|
|
||||||
get proxy() {
|
|
||||||
return new Router(this.rest).createProxy();
|
|
||||||
}
|
|
||||||
|
|
||||||
setServices({ rest, cache, langs, middlewares, handleCommand }: ServicesOptions) {
|
setServices({ rest, cache, langs, middlewares, handleCommand }: ServicesOptions) {
|
||||||
if (rest) {
|
if (rest) {
|
||||||
this.rest = rest;
|
this.rest = rest;
|
||||||
|
this.proxy = new Router(this.rest).createProxy();
|
||||||
}
|
}
|
||||||
if (cache) {
|
if (cache) {
|
||||||
const caches: (keyof Cache['disabledCache'])[] = [
|
const caches: (keyof Cache['disabledCache'])[] = [
|
||||||
@ -275,6 +273,7 @@ export class BaseClient {
|
|||||||
domain: 'https://discord.com',
|
domain: 'https://discord.com',
|
||||||
debug,
|
debug,
|
||||||
});
|
});
|
||||||
|
this.proxy = new Router(this.rest).createProxy();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.cache) {
|
if (this.cache) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user