package io.arkeus.fatebot.commands.impl;

import org.jibble.pircbot.Colors;

import io.arkeus.fatebot.commands.Command;
import io.arkeus.fatebot.commands.CommandException;
import io.arkeus.fatebot.handlers.TrapHandler;
import io.arkeus.fatebot.util.MessageBuilder;

public class PeekCommand extends Command {
	private static final MessageBuilder mb = new MessageBuilder();

	public PeekCommand() {
		super(0);
	}

	@Override
	protected void run() throws CommandException {
		if (!bot.isAdministrator(sender)) {
			return;
		}

		final TrapHandler handler = (TrapHandler) bot.getHandler("trap");
		final String trap = handler.getTrap();
		if (trap == null) {
			bot.sendNotice(sender, "No trap card is set.");
			return;
		}

		final String trapper = handler.getTrapper();
		mb.clear();
		mb.appendBrackets("Trap", trap, Colors.BLUE).append(" ");
		mb.appendBrackets("Trapper", trapper, Colors.BROWN);
		bot.sendNotice(sender, mb.toString());
	}
}
@@ -257,16 +257,57 @@
 Builder;
+%0Aimport io.arkeus.fatebot.util.TimeUtils;
 %0A%0Apublic
@@ -933,16 +933,140 @@
 s.BROWN)
+.append(%22 %22);%0A%09%09mb.appendBrackets(%22Time%22, TimeUtils.getDurationFromMillis(handler.getTrapTime()) + %22 ago%22, Colors.DARK_BLUE)
 ;%0A%09%09bot.

Add time to peek command.