package fr.Skydust.JdrBot.bases.command;

import net.dv8tion.jda.api.events.message.MessageReceivedEvent;

public abstract class Command {
    public String cmdName;
    public String cmdDesc;
    public String cmdUsage = "";
    public boolean hidden = false;

    public Command() {
        if (!getClass().isAnnotationPresent(CommandSpec.class)) {
            throw new WrongCommandSpecException("The command spec was not declared ! (@CommandSpec)");
        }

        CommandSpec specs = getClass().getAnnotation(CommandSpec.class);
        if (specs.name().isEmpty()) {
            throw new WrongCommandSpecException("The command name is invalid.");
        }

        cmdName = specs.name();
        cmdDesc = specs.description();
        cmdUsage = specs.usage();

        if (getClass().isAnnotationPresent(HideCommand.class)) {
            hidden = true;
        }
    }

    public abstract void call(MessageReceivedEvent e);
}


