From 188ffdc1f804e0bd9966154befa8c94cf6389bdd Mon Sep 17 00:00:00 2001 From: ITOH Date: Sun, 13 Jun 2021 21:45:36 +0200 Subject: [PATCH] add: isSlashCommand typeGuard --- src/types/channels/threads/is_slash_command.ts | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 src/types/channels/threads/is_slash_command.ts diff --git a/src/types/channels/threads/is_slash_command.ts b/src/types/channels/threads/is_slash_command.ts new file mode 100644 index 000000000..9fedf32c1 --- /dev/null +++ b/src/types/channels/threads/is_slash_command.ts @@ -0,0 +1,7 @@ +import { Interaction, SlashCommandInteraction } from "../../interactions/interaction.ts"; +import { DiscordInteractionTypes } from "../../interactions/interaction_types.ts"; + +/** A type guard function to tell if it is a slash command interaction */ +export function isSlashCommand(interaction: Interaction): interaction is SlashCommandInteraction { + return interaction.type === DiscordInteractionTypes.ApplicationCommand; +}