mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-20 21:43:33 +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) {
|
constructor(client, data) {
|
||||||
super(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
|
* The message to which the component was attached
|
||||||
* @type {Message|APIMessage}
|
* @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 readonly component: MessageActionRowComponent | Exclude<APIMessageComponent, APIActionRowComponent> | null;
|
||||||
public componentType: Exclude<MessageComponentType, 'ACTION_ROW'>;
|
public componentType: Exclude<MessageComponentType, 'ACTION_ROW'>;
|
||||||
public customId: string;
|
public customId: string;
|
||||||
|
public channelId: Snowflake;
|
||||||
public deferred: boolean;
|
public deferred: boolean;
|
||||||
public ephemeral: boolean | null;
|
public ephemeral: boolean | null;
|
||||||
public message: Message | APIMessage;
|
public message: Message | APIMessage;
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
import { APIInteractionGuildMember } from 'discord-api-types';
|
||||||
import {
|
import {
|
||||||
ApplicationCommand,
|
ApplicationCommand,
|
||||||
ApplicationCommandChoicesData,
|
ApplicationCommandChoicesData,
|
||||||
@@ -565,6 +566,10 @@ client.on('messageCreate', message => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
client.on('interaction', async interaction => {
|
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;
|
if (!interaction.isCommand()) return;
|
||||||
|
|
||||||
void new MessageActionRow();
|
void new MessageActionRow();
|
||||||
@@ -583,6 +588,10 @@ client.on('interaction', async interaction => {
|
|||||||
|
|
||||||
// @ts-expect-error
|
// @ts-expect-error
|
||||||
await interaction.reply({ content: 'Hi!', components: [button] });
|
await interaction.reply({ content: 'Hi!', components: [button] });
|
||||||
|
|
||||||
|
if (interaction.isMessageComponent()) {
|
||||||
|
assertType<Snowflake>(interaction.channelId);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
client.login('absolutely-valid-token');
|
client.login('absolutely-valid-token');
|
||||||
|
|||||||
Reference in New Issue
Block a user