mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-11 09:03:29 +01:00
feat(Interaction): add guild guard (#5955)
* feat(Interaction): add guild guard * fix: remove possibly uncached getters & duplicate method * fix: boolean ensuring Co-authored-by: Sugden <28943913+NotSugden@users.noreply.github.com> Co-authored-by: Sugden <28943913+NotSugden@users.noreply.github.com>
This commit is contained in:
committed by
GitHub
parent
706c6eae60
commit
87e8cdd3eb
@@ -105,6 +105,14 @@ class Interaction extends Base {
|
||||
return this.client.guilds.cache.get(this.guildID) ?? null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Indicates whether this interaction is received from a guild.
|
||||
* @returns {boolean}
|
||||
*/
|
||||
inGuild() {
|
||||
return Boolean(this.guildID && this.member);
|
||||
}
|
||||
|
||||
/**
|
||||
* Indicates whether this interaction is a command interaction.
|
||||
* @returns {boolean}
|
||||
|
||||
Reference in New Issue
Block a user