mirror of
https://github.com/sern-handler/handler
synced 2026-06-06 01:16:55 +00:00
chore: add agnostic predicates
This commit is contained in:
18
src/core/predicates.ts
Normal file
18
src/core/predicates.ts
Normal file
@@ -0,0 +1,18 @@
|
||||
import { AutocompleteInteraction, CommandInteraction, ModalSubmitInteraction } from "discord.js";
|
||||
import { BaseInteraction, InteractionType, MessageComponentInteraction } from "discord.js";
|
||||
|
||||
|
||||
export function isMessageComponent(i: BaseInteraction): i is MessageComponentInteraction {
|
||||
return i.type === InteractionType.MessageComponent;
|
||||
}
|
||||
|
||||
export function isCommand(i: BaseInteraction): i is CommandInteraction {
|
||||
return i.type === InteractionType.ApplicationCommand;
|
||||
}
|
||||
export function isAutocomplete(i: BaseInteraction): i is AutocompleteInteraction {
|
||||
return i.type === InteractionType.ApplicationCommandAutocomplete;
|
||||
}
|
||||
|
||||
export function isModal(i: BaseInteraction): i is ModalSubmitInteraction {
|
||||
return i.type === InteractionType.ModalSubmit;
|
||||
}
|
||||
Reference in New Issue
Block a user