mirror of
https://github.com/tiramisulabs/seyfert.git
synced 2025-07-02 21:16:09 +00:00
fix(structures): type guards
This commit is contained in:
parent
38cf6d79f6
commit
200f503110
@ -3,6 +3,9 @@ import type { Session } from "../../Session.ts";
|
||||
import type { DiscordInteraction } from "../../../discordeno/mod.ts";
|
||||
import type CommandInteraction from "./CommandInteraction.ts";
|
||||
import type PingInteraction from "./PingInteraction.ts";
|
||||
import type ComponentInteraction from "./ComponentInteraction.ts";
|
||||
import type ModalSubmitInteraction from "./ModalSubmitInteraction.ts";
|
||||
import type AutoCompleteInteraction from "./AutoCompleteInteraction.ts";
|
||||
import { InteractionTypes } from "../../../discordeno/mod.ts";
|
||||
import { Snowflake } from "../../Snowflake.ts";
|
||||
import User from "../User.ts";
|
||||
@ -60,11 +63,11 @@ export abstract class BaseInteraction implements Model {
|
||||
return this.type === InteractionTypes.ApplicationCommand;
|
||||
}
|
||||
|
||||
isAutoComplete() {
|
||||
isAutoComplete(): this is AutoCompleteInteraction {
|
||||
return this.type === InteractionTypes.ApplicationCommandAutocomplete;
|
||||
}
|
||||
|
||||
isComponent() {
|
||||
isComponent(): this is ComponentInteraction {
|
||||
return this.type === InteractionTypes.MessageComponent;
|
||||
}
|
||||
|
||||
@ -72,11 +75,11 @@ export abstract class BaseInteraction implements Model {
|
||||
return this.type === InteractionTypes.Ping;
|
||||
}
|
||||
|
||||
isModalSubmit() {
|
||||
isModalSubmit(): this is ModalSubmitInteraction {
|
||||
return this.type === InteractionTypes.ModalSubmit;
|
||||
}
|
||||
|
||||
inGuild() {
|
||||
inGuild(): this is this & { guildId: Snowflake } {
|
||||
return !!this.guildId;
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user