put back onto another thread
This commit is contained in:
parent
3e16f212da
commit
ab98d752c8
@ -153,36 +153,34 @@ public final class DiscordService {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// Initialize the bot
|
// Initialize the bot
|
||||||
long before = System.currentTimeMillis();
|
new Thread(() -> {
|
||||||
log.info("Logging in..."); // Log that we're logging in
|
long before = System.currentTimeMillis();
|
||||||
System.out.println("Step 1");
|
log.info("Logging in..."); // Log that we're logging in
|
||||||
JDA jda = JDABuilder.createDefault(token)
|
jda = JDABuilder.createDefault(token)
|
||||||
.enableIntents(
|
.enableIntents(
|
||||||
GatewayIntent.GUILD_MEMBERS
|
GatewayIntent.GUILD_MEMBERS
|
||||||
).setStatus(OnlineStatus.DO_NOT_DISTURB)
|
).setStatus(OnlineStatus.DO_NOT_DISTURB)
|
||||||
.setActivity(Activity.watching("your licenses"))
|
.setActivity(Activity.watching("your licenses"))
|
||||||
.addEventListeners(new EventHandler())
|
.addEventListeners(new EventHandler())
|
||||||
.build();
|
.build();
|
||||||
System.out.println("step 2");
|
try {
|
||||||
try {
|
jda.awaitReady(); // Await JDA to be ready
|
||||||
jda.awaitReady(); // Await JDA to be ready
|
|
||||||
System.out.println("await complete");
|
// Log that we're logged in
|
||||||
|
log.info("Logged into {} in {}ms",
|
||||||
// Log that we're logged in
|
jda.getSelfUser().getEffectiveName(), System.currentTimeMillis() - before
|
||||||
log.info("Logged into {} in {}ms",
|
);
|
||||||
jda.getSelfUser().getEffectiveName(), System.currentTimeMillis() - before
|
|
||||||
);
|
// Registering slash commands
|
||||||
|
jda.updateCommands().addCommands(
|
||||||
// Registering slash commands
|
Commands.slash("license", "Manage one of your licenses")
|
||||||
jda.updateCommands().addCommands(
|
.addOption(OptionType.STRING, "key", "The license key", true)
|
||||||
Commands.slash("license", "Manage one of your licenses")
|
.addOption(OptionType.STRING, "product", "The product the license is for", true)
|
||||||
.addOption(OptionType.STRING, "key", "The license key", true)
|
).queue();
|
||||||
.addOption(OptionType.STRING, "product", "The product the license is for", true)
|
} catch (InterruptedException ex) {
|
||||||
).queue();
|
ex.printStackTrace();
|
||||||
} catch (InterruptedException ex) {
|
}
|
||||||
ex.printStackTrace();
|
}, "Discord Bot Thread").start();
|
||||||
}
|
|
||||||
System.out.println("finish");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
x
Reference in New Issue
Block a user