types: allow raw components for reply and message options (#7573)

This commit is contained in:
Suneet Tipirneni
2022-03-02 04:34:22 -05:00
committed by GitHub
parent c6cb5e9ebb
commit 2d4971b032
2 changed files with 23 additions and 1 deletions

View File

@@ -94,6 +94,7 @@ import {
AuditLogEvent,
APIMessageComponentEmoji,
EmbedType,
APIActionRowComponentTypes,
} from 'discord-api-types/v9';
import { ChildProcess } from 'node:child_process';
import { EventEmitter } from 'node:events';
@@ -4600,7 +4601,11 @@ export interface MessageOptions {
nonce?: string | number;
content?: string | null;
embeds?: (Embed | APIEmbed)[];
components?: (ActionRow<ActionRowComponent> | (Required<BaseComponentData> & ActionRowData))[];
components?: (
| ActionRow<ActionRowComponent>
| (Required<BaseComponentData> & ActionRowData)
| APIActionRowComponent<APIActionRowComponentTypes>
)[];
allowedMentions?: MessageMentionOptions;
files?: (FileOptions | BufferResolvable | Stream | MessageAttachment)[];
reply?: ReplyOptions;

View File

@@ -740,6 +740,23 @@ client.on('interactionCreate', async interaction => {
// @ts-expect-error
await interaction.reply({ content: 'Hi!', components: [button] });
await interaction.reply({
content: 'test',
components: [
{
components: [
{
custom_id: 'abc',
label: 'abc',
style: ButtonStyle.Primary,
type: ComponentType.Button,
},
],
type: ComponentType.ActionRow,
},
],
});
if (interaction.isMessageComponent()) {
expectType<Snowflake>(interaction.channelId);
}