From fa338e6447783b7cd46d29f2879200031c63ce23 Mon Sep 17 00:00:00 2001 From: Fleny Date: Wed, 29 Jul 2026 08:00:08 +0200 Subject: [PATCH] feat: Add deleteCurrentUserApplicationRoleConnection endpoint (#5230) --- packages/bot/src/helpers.ts | 4 ++++ packages/rest/src/manager.ts | 9 +++++++++ packages/rest/src/types.ts | 12 ++++++++++++ 3 files changed, 25 insertions(+) diff --git a/packages/bot/src/helpers.ts b/packages/bot/src/helpers.ts index e6d6a9a76..26c407c6b 100644 --- a/packages/bot/src/helpers.ts +++ b/packages/bot/src/helpers.ts @@ -746,6 +746,9 @@ export function createBotHelpers { return await bot.rest.editUserApplicationRoleConnection(bearerToken, applicationId, options); }, + deleteCurrentUserApplicationRoleConnection: async (bearerToken, applicationId) => { + return await bot.rest.deleteCurrentUserApplicationRoleConnection(bearerToken, applicationId); + }, joinThread: async (channelId) => { return await bot.rest.joinThread(channelId); }, @@ -982,6 +985,7 @@ export type BotHelpers, ) => Promise>; + deleteCurrentUserApplicationRoleConnection: (bearerToken: string, applicationId: BigString) => Promise; executeWebhook: ( webhookId: BigString, token: string, diff --git a/packages/rest/src/manager.ts b/packages/rest/src/manager.ts index e2d076884..9b7bce5a4 100644 --- a/packages/rest/src/manager.ts +++ b/packages/rest/src/manager.ts @@ -1781,6 +1781,15 @@ export function createRestManager(options: CreateRestManagerOptions): RestManage }); }, + async deleteCurrentUserApplicationRoleConnection(bearerToken, applicationId) { + return await rest.delete(rest.routes.oauth2.roleConnections(applicationId), { + headers: { + authorization: `Bearer ${bearerToken}`, + }, + unauthorized: true, + }); + }, + async addGuildMember(guildId, userId, body) { return await rest.put(rest.routes.guilds.members.member(guildId, userId), { body, diff --git a/packages/rest/src/types.ts b/packages/rest/src/types.ts index 7a0bebafe..9edd719f6 100644 --- a/packages/rest/src/types.ts +++ b/packages/rest/src/types.ts @@ -1460,6 +1460,18 @@ export interface RestManager { applicationId: BigString, options: Camelize, ) => Promise>; + /** + * Deletes the application role connection for the user. + * + * @param bearerToken - The access token of the user + * @param applicationId - The id of the application to delete the role connection + * + * @remarks + * This requires the `role_connections.write` scope. + * + * @see {@link https://docs.discord.com/developers/resources/user#delete-current-user-application-role-connection} + */ + deleteCurrentUserApplicationRoleConnection: (bearerToken: string, applicationId: BigString) => Promise; /** * Edits a webhook. *