1 |
import { ModalSubmitInteraction } from 'discord-modals'; |
import { ModalSubmitInteraction } from 'discord-modals'; |
2 |
import { AutocompleteInteraction, CommandInteraction, CommandInteractionOption, Interaction, Message, MessageEditOptions, MessageOptions, MessagePayload, WebhookEditMessageOptions } from 'discord.js'; |
import { 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 |
|
|
40 |
|
|
41 |
} |
} |
42 |
|
|
43 |
async deferReply(msg: Message | CommandInteraction, options: MessageOptions | string | MessagePayload | WebhookEditMessageOptions, edit: boolean = false): Promise<Message | CommandInteraction> { |
async deferReply(msg: Message | CommandInteraction | ContextMenuInteraction, options: MessageOptions | string | MessagePayload | WebhookEditMessageOptions, edit: boolean = false): Promise<Message | CommandInteraction> { |
44 |
if (msg instanceof Message) { |
if (msg instanceof Message) { |
45 |
return await msg[edit ? 'edit' : 'reply'](options as (MessageOptions & MessageEditOptions)); |
return await msg[edit ? 'edit' : 'reply'](options as (MessageOptions & MessageEditOptions)); |
46 |
} |
} |