diff --git a/packages/proxy/src/index.ts b/packages/proxy/src/index.ts index 60df8f1eb4565..07fb9e2c5bbcb 100644 --- a/packages/proxy/src/index.ts +++ b/packages/proxy/src/index.ts @@ -1,18 +1,12 @@ import type { IncomingMessage, ServerResponse } from 'http'; -import { DiscordAPIError, RequestMethod, REST, RESTOptions, RouteLike } from '@discordjs/rest'; +import { DiscordAPIError, RequestMethod, REST, RouteLike } from '@discordjs/rest'; type Awaitable = T | PromiseLike; type RequestHandler = (req: IncomingMessage, res: ServerResponse) => Awaitable; -export interface ProxyOptions extends RESTOptions { - token: string; -} - export const VALID_METHODS = ['GET', 'POST', 'PUT', 'PATCH', 'DELETE']; -// Should this actually support passing in an existing REST instance? -export function proxyRequests(options: REST | ProxyOptions): RequestHandler { - const rest = options instanceof REST ? options : new REST(options).setToken(options.token); +export function proxyRequests(rest: REST): RequestHandler { return async (req, res) => { // TODO: Parse the URL. REST always appends /api/v[version] const { method, url } = req;