1 |
rakin |
51 |
import { CommandInteraction, CommandInteractionOption, Interaction, Message, MessageEditOptions, MessageOptions, MessagePayload, WebhookEditMessageOptions } from 'discord.js'; |
2 |
|
|
import DiscordClient from '../../client/Client'; |
3 |
|
|
import CommandOptions from '../../types/CommandOptions'; |
4 |
|
|
import InteractionOptions from '../../types/InteractionOptions'; |
5 |
|
|
|
6 |
|
|
export default abstract class BaseCommand { |
7 |
|
|
supportsInteractions: boolean = false; |
8 |
|
|
supportsLegacy: boolean = true; |
9 |
rakin |
56 |
coolDown?: number; |
10 |
rakin |
58 |
ownerOnly: boolean = false; |
11 |
rakin |
51 |
|
12 |
|
|
constructor(private name: string, private category: string, private aliases: Array<string>) { |
13 |
|
|
|
14 |
|
|
} |
15 |
|
|
|
16 |
|
|
getName(): string { |
17 |
|
|
return this.name; |
18 |
|
|
} |
19 |
|
|
|
20 |
|
|
getCategory(): string { |
21 |
|
|
return this.category; |
22 |
|
|
} |
23 |
|
|
|
24 |
|
|
getAliases(): Array<string> { |
25 |
|
|
return this.aliases; |
26 |
|
|
} |
27 |
|
|
|
28 |
|
|
async deferReply(msg: Message | CommandInteraction, options: MessageOptions | string | MessagePayload | WebhookEditMessageOptions, edit: boolean = false): Promise<Message | CommandInteraction> { |
29 |
|
|
if (msg instanceof Message) { |
30 |
|
|
return await msg[edit ? 'edit' : 'reply'](options as (MessageOptions & MessageEditOptions)); |
31 |
|
|
} |
32 |
|
|
|
33 |
|
|
return (await msg.editReply(options as string | MessagePayload | WebhookEditMessageOptions)) as Message; |
34 |
|
|
} |
35 |
|
|
|
36 |
|
|
abstract run(client: DiscordClient, message: Message | Interaction, options: CommandOptions | InteractionOptions): Promise<void>; |
37 |
|
|
} |