fix(rest): proxy cumulative routes

This commit is contained in:
socram03 2023-06-05 05:01:57 +00:00
parent dbc5922ffb
commit 0436a4b162
4 changed files with 15 additions and 19 deletions

View File

@ -1,3 +1,3 @@
export * from "./slash/SlashCommand"; export * from './slash/SlashCommand';
export * from "./slash/SlashCommandOption"; export * from './slash/SlashCommandOption';
export * from "./contextMenu/ContextCommand"; export * from './contextMenu/ContextCommand';

View File

@ -1,5 +1,5 @@
export * from "./ActionRow"; export * from './ActionRow';
export * from "./MessageButton"; export * from './MessageButton';
export * from "./SelectMenu"; export * from './SelectMenu';
export * from "./TextInput"; export * from './TextInput';
export * from "./BaseComponent"; export * from './BaseComponent';

View File

@ -25,12 +25,10 @@ export class Router {
if (ArrRequestsMethods.includes(key)) { if (ArrRequestsMethods.includes(key)) {
return (...options: any[]) => this.rest[key](`/${route.join('/')}`, ...options); return (...options: any[]) => this.rest[key](`/${route.join('/')}`, ...options);
} }
route.push(key); return this.createProxy([...route, key]);
return this.createProxy(route);
}, },
apply: (...[, _, args]) => { apply: (...[, _, args]) => {
route.push(...args.filter((x) => x != null)); return this.createProxy([...route, ...args.filter((x) => x != null)]);
return this.createProxy(route);
} }
}) as unknown as Routes; }) as unknown as Routes;
} }
@ -48,7 +46,7 @@ export class CDN {
const lastRoute = `${CDN_URL}/${route.join('/')}`; const lastRoute = `${CDN_URL}/${route.join('/')}`;
if (value) { if (value) {
if (typeof value !== 'string') { if (typeof value !== 'string') {
// rome-ignore lint/style/noParameterAssign: ?! // rome-ignore lint/nursery/noParameterAssign: fix multiples value types
value = String(value); value = String(value);
} }
return `${lastRoute}/${value}`; return `${lastRoute}/${value}`;
@ -56,12 +54,10 @@ export class CDN {
return lastRoute; return lastRoute;
}; };
} }
route.push(key); return this.createProxy([...route, key]);
return this.createProxy(route);
}, },
apply: (...[, _, args]) => { apply: (...[, _, args]) => {
route.push(...args.filter((x) => x != null)); return this.createProxy([...route, ...args.filter((x) => x != null)]);
return this.createProxy(route);
} }
}) as unknown as CDNRoutes; }) as unknown as CDNRoutes;
} }