mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-09 16:13:31 +01:00
typings: make channelId non-nullable on MessageComponentInteraction (#6600)
This commit is contained in:
@@ -14,6 +14,12 @@ class MessageComponentInteraction extends Interaction {
|
||||
constructor(client, data) {
|
||||
super(client, data);
|
||||
|
||||
/**
|
||||
* The id of the channel this interaction was sent in
|
||||
* @type {Snowflake}
|
||||
* @name MessageComponentInteraction#channelId
|
||||
*/
|
||||
|
||||
/**
|
||||
* The message to which the component was attached
|
||||
* @type {Message|APIMessage}
|
||||
|
||||
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