Files

26 lines
897 B
TypeScript
Raw Permalink Normal View History

2021-05-13 16:05:44 +02:00
import { GuildMember, Message, MessageEmbed } from 'discord.js';
2021-05-13 16:18:31 +02:00
import { config } from '.';
2021-05-13 16:05:44 +02:00
import { Argument } from './argument';
2021-05-13 16:18:31 +02:00
import { Color } from './color';
2021-05-13 03:20:36 +02:00
export abstract class Command {
public abstract name(): string;
public abstract description(): string;
2021-05-13 16:05:44 +02:00
public abstract arguments(): Array<Argument>;
public help(): MessageEmbed {
const embed: MessageEmbed = new MessageEmbed()
.setTitle(config.discord.commandPrefix + this.name())
2021-05-13 16:18:31 +02:00
.setColor(Color.primary)
2021-05-13 16:05:44 +02:00
.setDescription(this.description());
for (const argument of this.arguments())
embed.addField(`${argument.name}: ${argument.type}`, argument.description, true);
return embed;
}
2021-05-13 03:20:36 +02:00
public abstract permitted(member: GuildMember): Promise<boolean>;
public abstract handle(message: Message, args: Array<string>): Promise<void>;
}