mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-17 20:13:30 +01:00
types(Interaction): change inGuild return type (#6094)
This commit is contained in:
2
typings/index.d.ts
vendored
2
typings/index.d.ts
vendored
@@ -831,7 +831,7 @@ export class Interaction extends Base {
|
|||||||
public type: InteractionType;
|
public type: InteractionType;
|
||||||
public user: User;
|
public user: User;
|
||||||
public version: number;
|
public version: number;
|
||||||
public inGuild(): boolean;
|
public inGuild(): this is this & { guildId: Snowflake; member: GuildMember | APIInteractionGuildMember };
|
||||||
public isButton(): this is ButtonInteraction;
|
public isButton(): this is ButtonInteraction;
|
||||||
public isCommand(): this is CommandInteraction;
|
public isCommand(): this is CommandInteraction;
|
||||||
public isMessageComponent(): this is MessageComponentInteraction;
|
public isMessageComponent(): this is MessageComponentInteraction;
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ import {
|
|||||||
GuildMember,
|
GuildMember,
|
||||||
GuildResolvable,
|
GuildResolvable,
|
||||||
Intents,
|
Intents,
|
||||||
|
Interaction,
|
||||||
Message,
|
Message,
|
||||||
MessageActionRow,
|
MessageActionRow,
|
||||||
MessageAttachment,
|
MessageAttachment,
|
||||||
@@ -604,3 +605,7 @@ client.on('messageReactionAdd', async reaction => {
|
|||||||
if (reaction.message.partial) return assertType<string | null>(reaction.message.content);
|
if (reaction.message.partial) return assertType<string | null>(reaction.message.content);
|
||||||
assertType<string>(reaction.message.content);
|
assertType<string>(reaction.message.content);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Test interactions
|
||||||
|
declare const interaction: Interaction;
|
||||||
|
if (interaction.inGuild()) assertType<Snowflake>(interaction.guildId);
|
||||||
|
|||||||
Reference in New Issue
Block a user