This commit is contained in:
nora 2022-09-05 18:59:10 +02:00
parent de0a891ef9
commit a00465ee89
3 changed files with 10 additions and 29 deletions

View file

@ -26,17 +26,11 @@ public class EvalCommand extends Command {
case "help" -> {
EmbedBuilder builder = Config.getDefaultEmbed()
.setTitle("Bot Admin only")
.addField("shutdown", "shutdown the bot", false)
.addField("triviadump", "Get JSON", false)
.addField("triviaset", "Set JSON. Make sure to backup the JSON beforehand with `triviadump`", false)
.addField("reloadtrivia", "Reload the new trivia File", false)
.addField("jar", "Upload a new jar file", false);
.addField("reloadtrivia", "Reload the new trivia File", false);
reply(builder.build());
}
case "shutdown" -> {
reply("Shutting down KilluaBot...");
System.exit(0);
}
case "triviadump" -> {
File f = TriviaQuestionData.getFile();
event.getTextChannel().sendMessage("Trivia Questions JSON File:").addFile(f).queue();
@ -53,22 +47,6 @@ public class EvalCommand extends Command {
TriviaQuestionData.reload();
reply("Reloaded Trivia Questions");
}
case "jar" -> {
List<Message.Attachment> attachments = event.getMessage().getAttachments();
if (attachments.size() > 0) {
try {
attachments.get(0).downloadToFile(
new File(EvalCommand.class.getProtectionDomain().getCodeSource()
.getLocation().toURI())).thenRun(() -> {
reply("Downloaded jar file");
});
} catch (URISyntaxException e) {
reply("Error: " + e.getMessage());
}
} else {
reply("JSON File not found");
}
}
default -> {
reply("Command is invalid.");
}

View file

@ -6,12 +6,14 @@ import net.dv8tion.jda.api.EmbedBuilder;
import net.dv8tion.jda.api.entities.User;
public class InviteCommand extends Command {
public class InfoCommand extends Command {
private static final String INVITE_LINK =
"(https://discord.com/api/oauth2/authorize?client_id=801015254023798825&permissions=8&scope=bot)";
private static final String GH_LINK = "(https://github.com/Nilstrieb/KilluaBot)";
public InviteCommand() {
super("invite", "Get the invite link for this bot");
public InfoCommand() {
super("info", "Get info about this bot");
}
@Override
@ -23,8 +25,9 @@ public class InviteCommand extends Command {
}
EmbedBuilder builder = Config.getDefaultEmbed()
.setTitle("Invite Killua to your server!")
.setTitle("Killua Info!")
.addField("Invite link", "[Invite]" + INVITE_LINK, true)
.addField("Source code", "[Github (messy)]" + GH_LINK, true)
.setFooter("This bot was made by " + nils.getAsTag(), nils.getAvatarUrl());
reply(builder.build());
}

View file

@ -5,7 +5,7 @@ import com.github.nilstrieb.commands.fun.*;
import com.github.nilstrieb.commands.fun.trivia.TriviaCommand;
import com.github.nilstrieb.commands.info.EvalCommand;
import com.github.nilstrieb.commands.info.HelpCommand;
import com.github.nilstrieb.commands.info.InviteCommand;
import com.github.nilstrieb.commands.info.InfoCommand;
import com.github.nilstrieb.commands.util.EmoteAddCommand;
import com.github.nilstrieb.core.command.CommandListener;
import com.github.nilstrieb.core.reactions.ReactionEventListener;
@ -83,7 +83,7 @@ public class Main {
new HelpCommand();
new EvalCommand();
new SayCommand();
new InviteCommand();
new InfoCommand();
new QuoteCommand();
new DepartureCommand();
new TriviaCommand();