mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-15 11:03:30 +01:00
types(MessageOptions): fix components being optional (#6005)
This commit is contained in:
2
typings/index.d.ts
vendored
2
typings/index.d.ts
vendored
@@ -3728,7 +3728,7 @@ declare module 'discord.js' {
|
|||||||
type MessageActionRowComponentResolvable = MessageActionRowComponent | MessageActionRowComponentOptions;
|
type MessageActionRowComponentResolvable = MessageActionRowComponent | MessageActionRowComponentOptions;
|
||||||
|
|
||||||
interface MessageActionRowOptions extends BaseMessageComponentOptions {
|
interface MessageActionRowOptions extends BaseMessageComponentOptions {
|
||||||
components?: MessageActionRowComponentResolvable[];
|
components: MessageActionRowComponentResolvable[];
|
||||||
}
|
}
|
||||||
|
|
||||||
interface MessageActivity {
|
interface MessageActivity {
|
||||||
|
|||||||
@@ -5,7 +5,9 @@ import {
|
|||||||
Collection,
|
Collection,
|
||||||
Intents,
|
Intents,
|
||||||
Message,
|
Message,
|
||||||
|
MessageActionRow,
|
||||||
MessageAttachment,
|
MessageAttachment,
|
||||||
|
MessageButton,
|
||||||
MessageEmbed,
|
MessageEmbed,
|
||||||
Permissions,
|
Permissions,
|
||||||
Serialized,
|
Serialized,
|
||||||
@@ -380,6 +382,26 @@ client.on('message', ({ channel }) => {
|
|||||||
channel.send({ another: 'property' });
|
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');
|
client.login('absolutely-valid-token');
|
||||||
|
|
||||||
// Test type transformation:
|
// Test type transformation:
|
||||||
|
|||||||
Reference in New Issue
Block a user