types(Interaction): allow Interaction cached properties to be type narrowed (#6668)

Co-authored-by: Sugden <28943913+NotSugden@users.noreply.github.com>
Co-authored-by: Rodry <38259440+ImRodry@users.noreply.github.com>
Co-authored-by: Antonio Román <kyradiscord@gmail.com>
This commit is contained in:
Suneet Tipirneni
2021-10-04 18:01:43 -04:00
committed by GitHub
parent f88f4cca64
commit d873a19d34
4 changed files with 156 additions and 9 deletions

View File

@@ -120,6 +120,22 @@ class Interaction extends Base {
return Boolean(this.guildId && this.member);
}
/**
* Indicates whether or not this interaction is both cached and received from a guild.
* @returns {boolean}
*/
inCachedGuild() {
return Boolean(this.guild && this.member);
}
/**
* Indicates whether or not this interaction is received from an uncached guild.
* @returns {boolean}
*/
inRawGuild() {
return Boolean(this.guildId && !this.guild && this.member);
}
/**
* Indicates whether this interaction is a {@link CommandInteraction}.
* @returns {boolean}