diff --git a/typings/index.d.ts b/typings/index.d.ts index 9aea995c4..bf72bc203 100644 --- a/typings/index.d.ts +++ b/typings/index.d.ts @@ -3728,7 +3728,7 @@ declare module 'discord.js' { type MessageActionRowComponentResolvable = MessageActionRowComponent | MessageActionRowComponentOptions; interface MessageActionRowOptions extends BaseMessageComponentOptions { - components?: MessageActionRowComponentResolvable[]; + components: MessageActionRowComponentResolvable[]; } interface MessageActivity { diff --git a/typings/index.ts b/typings/index.ts index cf71854b8..cd5df0a07 100644 --- a/typings/index.ts +++ b/typings/index.ts @@ -5,7 +5,9 @@ import { Collection, Intents, Message, + MessageActionRow, MessageAttachment, + MessageButton, MessageEmbed, Permissions, Serialized, @@ -380,6 +382,26 @@ client.on('message', ({ channel }) => { channel.send({ another: 'property' }); }); +client.on('interaction', async interaction => { + if (!interaction.isCommand()) return; + + void new MessageActionRow(); + + const button = new MessageButton(); + + const actionRow = new MessageActionRow({ components: [button] }); + + await interaction.reply({ content: 'Hi!', components: [actionRow] }); + + await interaction.reply({ content: 'Hi!', components: [[button]] }); + + // @ts-expect-error + void new MessageActionRow({}); + + // @ts-expect-error + await interaction.reply({ content: 'Hi!', components: [button] }); +}); + client.login('absolutely-valid-token'); // Test type transformation: