From d945430c32e5c5f63b12eb4911b322c9ed01b922 Mon Sep 17 00:00:00 2001 From: Jiralite <33201955+Jiralite@users.noreply.github.com> Date: Tue, 22 Aug 2023 18:52:16 +0100 Subject: [PATCH] feat: add to core --- packages/core/src/api/applications.ts | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/packages/core/src/api/applications.ts b/packages/core/src/api/applications.ts index 1bf8622ae9d9..736cb4e14f5e 100644 --- a/packages/core/src/api/applications.ts +++ b/packages/core/src/api/applications.ts @@ -1,7 +1,14 @@ /* eslint-disable jsdoc/check-param-names */ import type { RequestData, REST } from '@discordjs/rest'; -import { type RESTGetCurrentApplicationResult, Routes } from 'discord-api-types/v10'; +import { + type RESTGetCurrentApplicationResult, + // @ts-expect-error discord-api-types + type RESTPatchCurrentApplicationJSONBody, + // @ts-expect-error discord-api-types + type RESTPatchCurrentApplicationResult, + Routes, +} from 'discord-api-types/v10'; export class ApplicationsAPI { public constructor(private readonly rest: REST) {} @@ -15,4 +22,18 @@ export class ApplicationsAPI { public async getCurrent({ signal }: Pick = {}) { return this.rest.get(Routes.currentApplication(), { signal }) as Promise; } + + /** + * Edits properties of the application associated with the requesting bot user. + * + * @see {@link https://discord.com/developers/docs/resources/application#edit-current-application} + * @param body - The new application data + * @param options - The options for editing the application + */ + public async editCurrent(body: RESTPatchCurrentApplicationJSONBody, { signal }: Pick = {}) { + return this.rest.patch(Routes.currentApplication(), { + body, + signal, + }) as Promise; + } }