mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-19 04:53:30 +01:00
typings: make channelId non-nullable on MessageComponentInteraction (#6600)
This commit is contained in:
1
typings/index.d.ts
vendored
1
typings/index.d.ts
vendored
@@ -1318,6 +1318,7 @@ export class MessageComponentInteraction extends Interaction {
|
||||
public readonly component: MessageActionRowComponent | Exclude<APIMessageComponent, APIActionRowComponent> | null;
|
||||
public componentType: Exclude<MessageComponentType, 'ACTION_ROW'>;
|
||||
public customId: string;
|
||||
public channelId: Snowflake;
|
||||
public deferred: boolean;
|
||||
public ephemeral: boolean | null;
|
||||
public message: Message | APIMessage;
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { APIInteractionGuildMember } from 'discord-api-types';
|
||||
import {
|
||||
ApplicationCommand,
|
||||
ApplicationCommandChoicesData,
|
||||
@@ -565,6 +566,10 @@ client.on('messageCreate', message => {
|
||||
});
|
||||
|
||||
client.on('interaction', async interaction => {
|
||||
assertType<Snowflake | null>(interaction.guildId);
|
||||
assertType<Snowflake | null>(interaction.channelId);
|
||||
assertType<GuildMember | APIInteractionGuildMember | null>(interaction.member);
|
||||
|
||||
if (!interaction.isCommand()) return;
|
||||
|
||||
void new MessageActionRow();
|
||||
@@ -583,6 +588,10 @@ client.on('interaction', async interaction => {
|
||||
|
||||
// @ts-expect-error
|
||||
await interaction.reply({ content: 'Hi!', components: [button] });
|
||||
|
||||
if (interaction.isMessageComponent()) {
|
||||
assertType<Snowflake>(interaction.channelId);
|
||||
}
|
||||
});
|
||||
|
||||
client.login('absolutely-valid-token');
|
||||
|
||||
Reference in New Issue
Block a user