1 |
import { AutocompleteInteraction, CommandInteraction, CommandInteractionOption, Interaction, Message, MessageEditOptions, MessageOptions, MessagePayload, WebhookEditMessageOptions } from 'discord.js'; |
import { ModalSubmitInteraction } from 'discord-modals'; |
2 |
|
import { PermissionResolvable, AutocompleteInteraction, CommandInteraction, CommandInteractionOption, ContextMenuInteraction, Interaction, Message, MessageEditOptions, MessageOptions, MessagePayload, WebhookEditMessageOptions } from 'discord.js'; |
3 |
import DiscordClient from '../../client/Client'; |
import DiscordClient from '../../client/Client'; |
4 |
import AutoCompleteOptions from '../../types/AutoCompleteOptions'; |
import AutoCompleteOptions from '../../types/AutoCompleteOptions'; |
5 |
import CommandOptions from '../../types/CommandOptions'; |
import CommandOptions from '../../types/CommandOptions'; |
8 |
export default abstract class BaseCommand { |
export default abstract class BaseCommand { |
9 |
supportsInteractions: boolean = false; |
supportsInteractions: boolean = false; |
10 |
supportsLegacy: boolean = true; |
supportsLegacy: boolean = true; |
11 |
|
supportsContextMenu: boolean = false; |
12 |
coolDown?: number; |
coolDown?: number; |
13 |
ownerOnly: boolean = false; |
ownerOnly: boolean = false; |
14 |
|
permissions: PermissionResolvable[] = []; |
15 |
|
|
16 |
constructor(private name: string, private category: string, private aliases: Array<string>) { |
constructor(private name: string, private category: string, private aliases: Array<string>) { |
17 |
|
|
18 |
} |
} |
19 |
|
|
20 |
getName(): string { |
getName(): string { |
33 |
|
|
34 |
} |
} |
35 |
|
|
36 |
async deferReply(msg: Message | CommandInteraction, options: MessageOptions | string | MessagePayload | WebhookEditMessageOptions, edit: boolean = false): Promise<Message | CommandInteraction> { |
async default(client: DiscordClient, interaction: Interaction): Promise <void> { |
37 |
|
|
38 |
|
} |
39 |
|
|
40 |
|
async modalSubmit(client: DiscordClient, interaction: ModalSubmitInteraction): Promise <void> { |
41 |
|
|
42 |
|
} |
43 |
|
|
44 |
|
async deferReply(msg: Message | CommandInteraction | ContextMenuInteraction, options: MessageOptions | string | MessagePayload | WebhookEditMessageOptions, edit: boolean = false): Promise<Message | CommandInteraction> { |
45 |
if (msg instanceof Message) { |
if (msg instanceof Message) { |
46 |
return await msg[edit ? 'edit' : 'reply'](options as (MessageOptions & MessageEditOptions)); |
return await msg[edit ? 'edit' : 'reply'](options as (MessageOptions & MessageEditOptions)); |
47 |
} |
} |
50 |
} |
} |
51 |
|
|
52 |
abstract run(client: DiscordClient, message: Message | Interaction, options: CommandOptions | InteractionOptions): Promise<void>; |
abstract run(client: DiscordClient, message: Message | Interaction, options: CommandOptions | InteractionOptions): Promise<void>; |
|
} |
|
53 |
|
} |