package me.despawningbone.discordbot.command.misc;

import java.util.Arrays;
import java.util.List;
import java.util.Random;

import me.despawningbone.discordbot.command.Command;
import me.despawningbone.discordbot.command.CommandResult;
import me.despawningbone.discordbot.command.CommandResult.CommandResultType;
import net.dv8tion.jda.api.entities.Message;
import net.dv8tion.jda.api.entities.channel.concrete.TextChannel;
import net.dv8tion.jda.api.entities.User;

public class EightBall extends Command {
	public EightBall() {
		this.name = "8ball";  //override name
		this.desc = "Ask the almighty 8ball!";
		this.usage = "<question>";
	}
	
	private List<String> responses = Arrays.asList(
			"`Seems true.`",
			"`Oops. Don't count on that.`",
			"`What did you say again?`",
			"`Sure.`",
			"`Nope. Just no.`",
			"`Ask your mom.`",
			"`Aint gonna answer ;)`",
			"`I approve.`",
			"`Chance of speaking the truth: 0.001%.`");

	@Override
	public CommandResult execute(TextChannel channel, User author, Message msg, String[] args) {
		if (args.length < 1)
			return new CommandResult(CommandResultType.INVALIDARGS, "Well, what do you even want to ask?");

		int choice = new Random().nextInt(responses.size());
		channel.sendMessage("The 8ball says:\n" + responses.get(choice)).queue();
		
		return new CommandResult(CommandResultType.SUCCESS);
	}
}
