diff --git a/Discord/build.gradle b/Discord/build.gradle index 5f8d9eb..fda0c02 100644 --- a/Discord/build.gradle +++ b/Discord/build.gradle @@ -18,8 +18,10 @@ dependencies { testImplementation 'org.junit.jupiter:junit-jupiter-params:5.10.0' testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.10.0' + implementation(fileTree(dir: "libs", include: "*.jar")) + jarLibs("net.dv8tion:JDA:5.0.0-beta.24") - jarLibs(files('libs/TuddyLIB.jar')) + jarLibs(fileTree(dir: "libs", include: "*.jar")) implementation configurations.jarLibs } diff --git a/Discord/src/main/java/com/baseband/bot/Main.java b/Discord/src/main/java/com/baseband/bot/Main.java index 26d33ae..86076a9 100644 --- a/Discord/src/main/java/com/baseband/bot/Main.java +++ b/Discord/src/main/java/com/baseband/bot/Main.java @@ -1,8 +1,5 @@ package com.baseband.bot; -//TIP To Run code, press or -// click the icon in the gutter. - import de.tudbut.io.TypedInputStream; import de.tudbut.io.TypedOutputStream; import de.tudbut.net.ws.Client; @@ -24,7 +21,6 @@ import org.jetbrains.annotations.NotNull; import java.io.IOException; import java.net.Socket; -import static de.tudbut.net.http.HTTPContentType.TCN; import static net.dv8tion.jda.api.interactions.commands.OptionType.STRING; import static net.dv8tion.jda.api.interactions.commands.OptionType.USER; @@ -83,7 +79,7 @@ public class Main extends ListenerAdapter { TypedInputStream tis; TypedOutputStream tos; try { - Socket connection = new Socket("baseband.lol", 40001); + Socket connection = new Socket("127.0.0.1", 40001); tis = new TypedInputStream(connection.getInputStream()); tos = new TypedOutputStream(connection.getOutputStream()); } catch (IOException e) { @@ -106,22 +102,23 @@ public class Main extends ListenerAdapter { switch (tis.readInt()) { case 201: { - event.reply("Reset the HWID of **`" + user.getName() + "`**.").setEphemeral(true).queue(); + event.getChannel().sendMessage("Reset the HWID of **`" + user.getName() + "`**.").queue(); + event.reply("`Success.`").setEphemeral(true).queue(); break; } case 403: { - event.reply("Incorrect Admin Password.").setEphemeral(true).queue(); + event.reply("`Incorrect Admin Password.`").setEphemeral(true).queue(); break; } case 400: { - event.reply("Error! I sent malformed data somehow.").setEphemeral(true).queue(); + event.reply("`Error! I sent malformed data somehow.`").setEphemeral(true).queue(); break; } case 404: { - event.reply("User Not Found, Do they have BaseBand?").setEphemeral(true).queue(); + event.reply("`User Not Found, Do they have BaseBand?`").setEphemeral(true).queue(); break; } @@ -145,6 +142,7 @@ public class Main extends ListenerAdapter { try { TCN tcn = new TCN(); tcn.set("action", "add"); + tcn.set("username", username); //wow yes don't give the username to the server-side great job tcn.set("authorisation", Hasher.sha512hex(password)); tcn.set("discord-id", user.getIdLong()); tos.writeString(tcn.toString()); @@ -156,22 +154,22 @@ public class Main extends ListenerAdapter { } case 403: { - event.reply("Incorrect Admin Password.").setEphemeral(true).queue(); + event.reply("`Incorrect Admin Password.`").setEphemeral(true).queue(); break; } case 409: { - event.reply("User already exists!").setEphemeral(true).queue(); + event.reply("`User already exists!`").setEphemeral(true).queue(); break; } case 400: { - event.reply("Error! I sent malformed data somehow.").setEphemeral(true).queue(); + event.reply("`Error! I sent malformed data somehow.`").setEphemeral(true).queue(); break; } default: { - event.reply("Error! I am out of sync with the server.").setEphemeral(true).queue(); + event.reply("`Error! I am out of sync with the server.`").setEphemeral(true).queue(); break; } } @@ -231,8 +229,4 @@ public class Main extends ListenerAdapter { event.reply("I can't handle that command right now :(").setEphemeral(true).queue(); } } - - public void say(SlashCommandInteractionEvent event, String content) { - event.reply(content).queue(); // This requires no permissions! - } } \ No newline at end of file diff --git a/Installer/src/main/java/com/baseband/login/LoginGenerator.java b/Installer/src/main/java/com/baseband/login/LoginGenerator.java index 0db94b9..6f21f9f 100644 --- a/Installer/src/main/java/com/baseband/login/LoginGenerator.java +++ b/Installer/src/main/java/com/baseband/login/LoginGenerator.java @@ -26,5 +26,10 @@ public class LoginGenerator { writer.println(k.encryptString(username)); writer.println(k.encryptString(password)); writer.println(k.encryptString("GENERATED USING " + LoginGenerator.class.getName() + "!!")); + //dumb as rocks + writer.flush(); + fos.flush(); + writer.close(); + fos.close(); } }