mirror of
https://github.com/2006-Scape/2006Scape.git
synced 2026-07-07 08:39:07 +00:00
Fixcrashesnov2020 (#425)
* Trycatch Discord Activity * Another exception catch
This commit is contained in:
@@ -22,6 +22,7 @@ public class JavaCord {
|
|||||||
public static void init() throws IOException {
|
public static void init() throws IOException {
|
||||||
if (token != null && !token.equals("")) { //If the token was loaded by loadSettings:
|
if (token != null && !token.equals("")) { //If the token was loaded by loadSettings:
|
||||||
new DiscordApiBuilder().setToken(token).login().thenAccept(api -> {
|
new DiscordApiBuilder().setToken(token).login().thenAccept(api -> {
|
||||||
|
try {
|
||||||
JavaCord.api = api;
|
JavaCord.api = api;
|
||||||
//System.out.println("You can invite the bot by using the following url: " + api.createBotInvite());
|
//System.out.println("You can invite the bot by using the following url: " + api.createBotInvite());
|
||||||
api.addListener(new Commands());
|
api.addListener(new Commands());
|
||||||
@@ -42,8 +43,12 @@ public class JavaCord {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
})
|
})
|
||||||
// Log any exceptions that happened
|
// Log exceptions (might not work now that we try(catch)
|
||||||
.exceptionally(ExceptionLogger.get());
|
.exceptionally(ExceptionLogger.get());
|
||||||
} else {
|
} else {
|
||||||
System.out.println("Discord Token Not Set So Bot Not Loaded");
|
System.out.println("Discord Token Not Set So Bot Not Loaded");
|
||||||
|
|||||||
Reference in New Issue
Block a user