mirror of
https://github.com/2006-Scape/2006Scape.git
synced 2026-07-03 00:31:51 +00:00
Fixcrashesnov2020 (#425)
* Trycatch Discord Activity * Another exception catch
This commit is contained in:
@@ -22,28 +22,33 @@ 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 -> {
|
||||||
JavaCord.api = api;
|
try {
|
||||||
//System.out.println("You can invite the bot by using the following url: " + api.createBotInvite());
|
JavaCord.api = api;
|
||||||
api.addListener(new Commands());
|
//System.out.println("You can invite the bot by using the following url: " + api.createBotInvite());
|
||||||
api.addListener(new Forum());
|
api.addListener(new Commands());
|
||||||
api.addListener(new Hiscores());
|
api.addListener(new Forum());
|
||||||
api.addListener(new Issues());
|
api.addListener(new Hiscores());
|
||||||
api.addListener(new Online());
|
api.addListener(new Issues());
|
||||||
api.addListener(new Players());
|
api.addListener(new Online());
|
||||||
api.addListener(new Vote());
|
api.addListener(new Players());
|
||||||
api.addListener(new Website());
|
api.addListener(new Vote());
|
||||||
api.addMessageCreateListener(event -> {
|
api.addListener(new Website());
|
||||||
|
api.addMessageCreateListener(event -> {
|
||||||
|
|
||||||
if (event.getMessageContent().startsWith("::movehome")) {
|
if (event.getMessageContent().startsWith("::movehome")) {
|
||||||
if (event.getMessageAuthor().isServerAdmin()) {
|
if (event.getMessageAuthor().isServerAdmin()) {
|
||||||
System.out.println("perms");
|
System.out.println("perms");
|
||||||
} else {
|
} else {
|
||||||
event.getChannel().sendMessage("You do not have permission to preform this command");
|
event.getChannel().sendMessage("You do not have permission to preform this command");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
});
|
|
||||||
|
} 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