Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,8 @@ public static void initialize() throws LoginException {
new SupportBannedPlayersCommand(),
new DiscussionMuteCommand(),
new NbsCommand(),
new DailySessionsCommand()
new DailySessionsCommand(),
new EightBallCommand()
);

JDABuilder builder = JDABuilder.createDefault(config.getToken())
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
package com.diamondfire.helpbot.bot.command.impl.other;

import com.diamondfire.helpbot.bot.command.argument.ArgumentSet;
import com.diamondfire.helpbot.bot.command.argument.impl.parsing.types.*;
import com.diamondfire.helpbot.bot.command.help.*;
import com.diamondfire.helpbot.bot.command.impl.Command;
import com.diamondfire.helpbot.bot.command.permissions.Permission;
import com.diamondfire.helpbot.bot.events.CommandEvent;
import net.dv8tion.jda.api.EmbedBuilder;

import java.util.Random;

public class EightBallCommand extends Command {

@Override
public String getName() {
return "8ball";
}

@Override
public String[] getAliases() {
return new String[]{"8b"};
}

@Override
public HelpContext getHelpContext() {
return new HelpContext()
.description("Helps make decisions.")
.category(CommandCategory.OTHER)
.addArgument(
new HelpContextArgument()
.name("question")
.optional()
);
}

@Override
public ArgumentSet compileArguments() {
return new ArgumentSet()
.addArgument("question",
new SingleArgumentContainer<>(new MessageArgument()).optional("Is vatten super duper cool?"));
}

@Override
public Permission getPermission() {
return Permission.USER;
}

@Override
public void run(CommandEvent event) {

String[] responses = new String[]{
"No.",
"Yes.",
"Maybe..",
"Definitely!",
"How about no..",
"Good question..",
"Sure why not",
"Go for it!",
"Without a doubt.",
"Most likely.",
"Very doubtful.",
"Brilliant idea!",
//"Ask owen\nDM: <@246778942323818506>\nPING: <@246778942323818506>",
"Mhmm..",
};

Random rdm = new Random();
EmbedBuilder builder = new EmbedBuilder();

builder.setTitle(":8ball: | " + event.getArgument("question"));
builder.setDescription(responses[rdm.nextInt(responses.length)]);

event.getChannel().sendMessage(builder.build()).queue();
}

}