From d8fc6ec02d9610e2809854fb42815765d6fbb05e Mon Sep 17 00:00:00 2001 From: Fleny Date: Mon, 27 Oct 2025 19:35:27 +0100 Subject: [PATCH] feat(bot)!: make desiredProperties generic in transformers (#4469) Updated desiredProperties in transformers to be generic so that it can be used to retrive the bot desired properties, and removed the option from `CreateBotOptions.transformers.desiredProperties` as that would cause the typings for the bot to be incorrect Co-authored-by: Awesome Stickz --- packages/bot/src/bot.ts | 4 ++-- packages/bot/src/transformers.ts | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/bot/src/bot.ts b/packages/bot/src/bot.ts index 53790dcd3..cb394bedc 100644 --- a/packages/bot/src/bot.ts +++ b/packages/bot/src/bot.ts @@ -41,7 +41,6 @@ export function createBot< type TypedBot = Bot if (!options.transformers) options.transformers = {} - if (!options.transformers.desiredProperties) options.transformers.desiredProperties = options.desiredProperties if (!options.rest) options.rest = { token: options.token, applicationId: options.applicationId } if (!options.rest.token) options.rest.token = options.token if (!options.rest.logger && options.loggerFactory) options.rest.logger = options.loggerFactory('REST') @@ -63,6 +62,7 @@ export function createBot< } options.gateway.intents = options.intents + ;(options.transformers as Transformers).desiredProperties = options.desiredProperties as CompleteProps const id = getBotIdFromToken(options.token) @@ -123,7 +123,7 @@ export interface CreateBotOptions>, TBehavior>> /** The functions that should transform discord objects to discordeno shaped objects. */ - transformers?: RecursivePartial>, TBehavior>> + transformers?: RecursivePartial>, TBehavior>, 'desiredProperties'>> /** The handler functions that should handle incoming discord payloads from gateway and call an event. */ handlers?: Partial>, TBehavior>>> /** diff --git a/packages/bot/src/transformers.ts b/packages/bot/src/transformers.ts index 9c3e9b2fa..2c0060ffb 100644 --- a/packages/bot/src/transformers.ts +++ b/packages/bot/src/transformers.ts @@ -351,7 +351,7 @@ export type Transformers & { customizers: TransformerCustomizers - desiredProperties: TransformersDesiredProperties + desiredProperties: TProps reverse: { activity: (bot: Bot, payload: Activity) => DiscordActivity allowedMentions: (bot: Bot, payload: AllowedMentions) => DiscordAllowedMentions