Changed types

This commit is contained in:
2025-08-15 20:34:41 +02:00
parent e8d8b449ce
commit e06787dd80
10 changed files with 59 additions and 74 deletions

View File

@@ -1,8 +0,0 @@
import { AutocompleteInteraction } from "discord.js"
import { ExtendedClient } from "~/utils/Client"
export interface IAutocomplete {
name: string
description: string
execute: (arg: { interaction: AutocompleteInteraction, client: ExtendedClient }) => Promise<void>
}

View File

@@ -1,8 +0,0 @@
import { ButtonInteraction } from "discord.js"
import { ExtendedClient } from "~/utils/Client"
export interface IButton {
name: string
description: string
execute: (arg: { interaction: ButtonInteraction, client: ExtendedClient }) => Promise<void>
}

View File

@@ -1,12 +0,0 @@
import { ChatInputCommandInteraction, SlashCommandBuilder } from "discord.js"
import { ExtendedClient as Client } from "~/utils/Client"
export interface ICommand {
name: string
description: string
dev?: boolean
public: boolean
subcommands?: boolean
data: SlashCommandBuilder
execute: (arg: { interaction: ChatInputCommandInteraction, client: Client }) => Promise<void>
}

View File

@@ -1,10 +0,0 @@
import { ContextMenuCommandBuilder, ContextMenuCommandInteraction } from "discord.js"
import { ExtendedClient } from "~/utils/Client"
export interface IContextMenu {
name: string
description: string
dev?: boolean
data: ContextMenuCommandBuilder
execute: (arg: { interaction: ContextMenuCommandInteraction, client: ExtendedClient }) => Promise<void>
}

55
src/typings/Discord.ts Normal file
View File

@@ -0,0 +1,55 @@
import {
AutocompleteInteraction,
ButtonInteraction,
ChatInputCommandInteraction,
ClientEvents,
ContextMenuCommandBuilder,
ContextMenuCommandInteraction,
ModalSubmitInteraction,
SlashCommandBuilder
} from "discord.js"
import { ExtendedClient } from "~/utils/Client"
export interface ICommand {
name: string
description: string
dev?: boolean
public: boolean
subcommands?: boolean
data: SlashCommandBuilder
execute: (arg: { interaction: ChatInputCommandInteraction, client: ExtendedClient }) => Promise<void>
}
export interface IContextMenu {
name: string
description: string
dev?: boolean
data: ContextMenuCommandBuilder
execute: (arg: { interaction: ContextMenuCommandInteraction, client: ExtendedClient }) => Promise<void>
}
export type SubCommand<T extends boolean = false> = (
arg: T extends true ? {
interaction: ChatInputCommandInteraction
client: ExtendedClient
} :
{
interaction: ChatInputCommandInteraction
}
) => Promise<void>
export interface IAutocomplete {
name: string
description: string
execute: (arg: { interaction: AutocompleteInteraction, client: ExtendedClient }) => Promise<void>
}
export interface IButton {
name: string
description: string
execute: (arg: { interaction: ButtonInteraction, client: ExtendedClient }) => Promise<void>
}
export interface IModal {
name: string
description: string
execute: (arg: { interaction: ModalSubmitInteraction, client: ExtendedClient }) => Promise<void>
}
export type Event<E extends keyof ClientEvents> = (...args: ClientEvents[E]) => void

View File

@@ -1,3 +0,0 @@
import { ClientEvents } from "discord.js"
export type Event<E extends keyof ClientEvents> = (...args: ClientEvents[E]) => void

View File

@@ -1,8 +0,0 @@
import { ModalSubmitInteraction } from "discord.js"
import { ExtendedClient } from "~/utils/Client"
export interface IModal {
name: string
description: string
execute: (arg: { interaction: ModalSubmitInteraction, client: ExtendedClient }) => Promise<void>
}

View File

@@ -1,14 +0,0 @@
import { ChatInputCommandInteraction } from "discord.js"
import { ExtendedClient } from "~/utils/Client"
type InteractionObject = {
interaction: ChatInputCommandInteraction
}
type ClientObject = {
client: ExtendedClient
}
type SubCommandObject<T extends boolean> = T extends true ? InteractionObject & ClientObject : InteractionObject
export type SubCommand<T extends boolean = false> = (arg: SubCommandObject<T>) => Promise<void>

View File

@@ -1,4 +1,4 @@
type TimeZonesArray = [ export type TimeZones = [
"Africa/Abidjan", "Africa/Abidjan",
"Africa/Accra", "Africa/Accra",
"Africa/Addis_Ababa", "Africa/Addis_Ababa",
@@ -427,6 +427,4 @@ type TimeZonesArray = [
"Pacific/Truk", "Pacific/Truk",
"Pacific/Wake", "Pacific/Wake",
"Pacific/Wallis" "Pacific/Wallis"
] ][number]
export type TimeZones = TimeZonesArray[number]

View File

@@ -1,11 +1,6 @@
export * from "./Autocomplete"
export * from "./Button"
export * from "./Command"
export * from "./ContextMenu"
export * from "./Cron" export * from "./Cron"
export * from "./Event" export * from "./Discord"
export * from "./General" export * from "./General"
export * from "./Guild" export * from "./Guild"
export * from "./Modal"
export * from "./Player" export * from "./Player"
export * from "./SubCommand" export * from "./TimeZones"