package org.royaldev.thehumanity.commands.impl;
import org.jetbrains.annotations.NotNull;
import org.kitteh.irc.client.library.element.User;
import org.kitteh.irc.client.library.event.helper.ActorEvent;
import org.royaldev.thehumanity.TheHumanity;
import org.royaldev.thehumanity.util.ConversionHelper;
import xyz.cardstock.cardstock.commands.BaseCommand;
import xyz.cardstock.cardstock.commands.CallInfo;
import xyz.cardstock.cardstock.commands.Command;
import java.util.List;
@Command(
name = "version",
description = "Shows the version of the bot."
)
public class VersionCommand extends BaseCommand {
private final TheHumanity humanity;
public VersionCommand(final TheHumanity instance) {
this.humanity = instance;
}
@Override
public void run(@NotNull ActorEvent<User> event, @NotNull CallInfo callInfo, @NotNull List<String> arguments) {
final String version = this.humanity.getVersion();
if (version.startsWith("Error:")) {
event.getActor().sendNotice(version);
} else {
ConversionHelper.respond(event, version);
}
}
}