diff --git a/packages/discord.js/src/structures/interfaces/InteractionResponses.js b/packages/discord.js/src/structures/interfaces/InteractionResponses.js index c32b82bf0..80244c678 100644 --- a/packages/discord.js/src/structures/interfaces/InteractionResponses.js +++ b/packages/discord.js/src/structures/interfaces/InteractionResponses.js @@ -237,7 +237,7 @@ class InteractionResponses { /** * Updates the original message of the component on which the interaction was received on. - * @param {string|MessagePayload|InteractionUpdateOptions} options The options for the updated message + * @param {string|MessagePayload|InteractionUpdateOptions} [options] The options for the updated message * @returns {Promise} * @example * // Remove the components from the message @@ -248,7 +248,7 @@ class InteractionResponses { * .then(console.log) * .catch(console.error); */ - async update(options) { + async update(options = {}) { if (this.deferred || this.replied) throw new DiscordjsError(ErrorCodes.InteractionAlreadyReplied); let messagePayload; diff --git a/packages/discord.js/typings/index.d.ts b/packages/discord.js/typings/index.d.ts index 0eb807c07..e95359290 100644 --- a/packages/discord.js/typings/index.d.ts +++ b/packages/discord.js/typings/index.d.ts @@ -2317,9 +2317,9 @@ export class MessageComponentInteraction e public update( options: InteractionUpdateOptions & { withResponse: true }, ): Promise>>; - public update(options: InteractionUpdateOptions & { withResponse: false }): Promise; + public update(options?: InteractionUpdateOptions & { withResponse: false }): Promise; public update( - options: string | MessagePayload | InteractionUpdateOptions, + options?: string | MessagePayload | InteractionUpdateOptions, ): Promise> | undefined>; public launchActivity( options: LaunchActivityOptions & { withResponse: true }, diff --git a/packages/discord.js/typings/index.test-d.ts b/packages/discord.js/typings/index.test-d.ts index eacfcfdaa..102732c3d 100644 --- a/packages/discord.js/typings/index.test-d.ts +++ b/packages/discord.js/typings/index.test-d.ts @@ -1942,6 +1942,7 @@ client.on('interactionCreate', async interaction => { expectType>>(interaction.editReply({ content: 'a' })); expectType>>(interaction.fetchReply()); expectType>>(interaction.update({ content: 'a', withResponse: true })); + expectType>(interaction.update()); expectType>>(interaction.deferUpdate({ withResponse: true })); expectType>(interaction.deferUpdate()); expectType>>(interaction.followUp({ content: 'a' })); @@ -1970,6 +1971,7 @@ client.on('interactionCreate', async interaction => { expectType>>(interaction.fetchReply()); expectType>>(interaction.update({ content: 'a', withResponse: true })); expectType>(interaction.update({ content: 'a', withResponse: false })); + expectType>(interaction.update()); expectType | undefined>>( interaction.update({ content: 'a', withResponse: booleanValue }), ); @@ -2004,6 +2006,7 @@ client.on('interactionCreate', async interaction => { expectType>( interaction.update({ content: 'a', withResponse: booleanValue }), ); + expectType>(interaction.update()); expectType>(interaction.deferUpdate({ withResponse: true })); expectType>(interaction.deferUpdate()); expectType>(interaction.followUp({ content: 'a' }));