diff --git a/src/main/java/net/Broken/MainBot.java b/src/main/java/net/Broken/MainBot.java
index 9b34f19..10d1ff3 100644
--- a/src/main/java/net/Broken/MainBot.java
+++ b/src/main/java/net/Broken/MainBot.java
@@ -38,6 +38,7 @@ public class MainBot {
public static boolean roleFlag = false;
public static HashMap spamUtils = new HashMap<>();
public static JDA jda;
+ public static boolean ready = false;
@@ -87,6 +88,7 @@ public class MainBot {
}
Init.polish(jda);
+ ready = true;
@@ -102,8 +104,14 @@ public class MainBot {
*/
public static void handleCommand(CommandParser.CommandContainer cmd)
{
- //On verifie que la commande existe
+ if(!ready)
+ {
+
+ return;
+ }
+
+ //On verifie que la commande existe
if (commandes.containsKey(cmd.commande))
{
Commande cmdObj = commandes.get(cmd.commande);
diff --git a/src/main/java/net/Broken/RestApi/GeneralApiController.java b/src/main/java/net/Broken/RestApi/GeneralApiController.java
new file mode 100644
index 0000000..ae994bc
--- /dev/null
+++ b/src/main/java/net/Broken/RestApi/GeneralApiController.java
@@ -0,0 +1,23 @@
+package net.Broken.RestApi;
+
+import net.Broken.MainBot;
+import org.springframework.http.HttpStatus;
+import org.springframework.http.ResponseEntity;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.RestController;
+
+@RestController
+@RequestMapping("/api/")
+public class GeneralApiController {
+ @RequestMapping(value = "/isReady", method = RequestMethod.GET)
+ public ResponseEntity isReady(){
+ if(MainBot.ready){
+ return new ResponseEntity<>(HttpStatus.OK);
+ }
+ else
+ {
+ return new ResponseEntity<>(HttpStatus.NOT_FOUND);
+ }
+ }
+}
diff --git a/src/main/java/net/Broken/webView/CheckPage.java b/src/main/java/net/Broken/webView/CheckPage.java
new file mode 100644
index 0000000..a54d731
--- /dev/null
+++ b/src/main/java/net/Broken/webView/CheckPage.java
@@ -0,0 +1,12 @@
+package net.Broken.webView;
+
+import net.Broken.MainBot;
+
+public class CheckPage {
+ public static String getPageIfReady(String page){
+ if(MainBot.ready)
+ return page;
+ else
+ return "loading";
+ }
+}
diff --git a/src/main/java/net/Broken/webView/GeneralWebView.java b/src/main/java/net/Broken/webView/GeneralWebView.java
index 34730ec..0f7287d 100644
--- a/src/main/java/net/Broken/webView/GeneralWebView.java
+++ b/src/main/java/net/Broken/webView/GeneralWebView.java
@@ -11,6 +11,11 @@ import org.springframework.web.bind.annotation.RequestMapping;
public class GeneralWebView {
@RequestMapping("/")
public String music(Model model){
- return "index";
+
+ return CheckPage.getPageIfReady("index");
+ }
+ @RequestMapping("/loading")
+ public String loading(Model model){
+ return "loading";
}
}
diff --git a/src/main/java/net/Broken/webView/MusicWebView.java b/src/main/java/net/Broken/webView/MusicWebView.java
index 73d203b..753aa35 100644
--- a/src/main/java/net/Broken/webView/MusicWebView.java
+++ b/src/main/java/net/Broken/webView/MusicWebView.java
@@ -11,6 +11,6 @@ import org.springframework.web.bind.annotation.RequestMapping;
public class MusicWebView {
@RequestMapping("/music")
public String music(Model model){
- return "music";
+ return CheckPage.getPageIfReady("music");
}
}
diff --git a/src/main/java/net/Broken/webView/RegisterWebView.java b/src/main/java/net/Broken/webView/RegisterWebView.java
index 537775c..49e403b 100644
--- a/src/main/java/net/Broken/webView/RegisterWebView.java
+++ b/src/main/java/net/Broken/webView/RegisterWebView.java
@@ -14,6 +14,6 @@ public class RegisterWebView {
@RequestMapping("/register")
public String music(@RequestParam(value="id", required = true, defaultValue = "") String id, Model model){
model.addAttribute("id", id);
- return "register";
+ return CheckPage.getPageIfReady("register");
}
}
diff --git a/src/main/resources/static/error/404.html b/src/main/resources/static/error/404.html
new file mode 100644
index 0000000..25decd3
--- /dev/null
+++ b/src/main/resources/static/error/404.html
@@ -0,0 +1,153 @@
+
+
+
+
+
+ Music Control - Discord Bot
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/main/resources/static/img/404.gif b/src/main/resources/static/img/404.gif
new file mode 100644
index 0000000..e0a1d6e
Binary files /dev/null and b/src/main/resources/static/img/404.gif differ
diff --git a/src/main/resources/static/js/loading.js b/src/main/resources/static/js/loading.js
new file mode 100644
index 0000000..6ce032e
--- /dev/null
+++ b/src/main/resources/static/js/loading.js
@@ -0,0 +1,18 @@
+$(document).ready(function () {
+ setInterval("loop()",1000);
+});
+
+function loop() {
+ $.ajax({
+ type: "GET",
+ url: "/api/isReady",
+ success: function (data) {
+ console.log("Ready");
+ debugger;
+ location.reload();
+ }
+
+ }).fail(function (data) {
+ console.log("Not ready");
+ });
+}
\ No newline at end of file
diff --git a/src/main/resources/templates/index.html b/src/main/resources/templates/index.html
index 453783a..ae77a64 100644
--- a/src/main/resources/templates/index.html
+++ b/src/main/resources/templates/index.html
@@ -124,8 +124,9 @@
-
-
+
diff --git a/src/main/resources/templates/loading.html b/src/main/resources/templates/loading.html
new file mode 100644
index 0000000..3fe4c7e
--- /dev/null
+++ b/src/main/resources/templates/loading.html
@@ -0,0 +1,79 @@
+
+
+
+
+
+ Music Control - Discord Bot
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Bot is starting
+
+
+
+
Please wait
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/main/resources/templates/music.html b/src/main/resources/templates/music.html
index d0c1bdc..78e88fd 100644
--- a/src/main/resources/templates/music.html
+++ b/src/main/resources/templates/music.html
@@ -360,7 +360,9 @@
-
+
+
diff --git a/src/main/resources/templates/youtubeCallBack.html b/src/main/resources/templates/youtubeCallBack.html
index 6b1b28a..448b551 100644
--- a/src/main/resources/templates/youtubeCallBack.html
+++ b/src/main/resources/templates/youtubeCallBack.html
@@ -129,7 +129,9 @@
-
+