Refactor DiscordBotInstance to initialize JDA lazily and standardize "Discord ID" terminology in appeal form.
This commit is contained in:
parent
7d59885395
commit
af9e1e627f
|
|
@ -17,10 +17,26 @@ public class DiscordBotInstance {
|
||||||
|
|
||||||
private DiscordBotInstance() {}
|
private DiscordBotInstance() {}
|
||||||
|
|
||||||
@Getter
|
|
||||||
private JDA jda;
|
private JDA jda;
|
||||||
private volatile boolean ready = false;
|
private volatile boolean ready = false;
|
||||||
|
|
||||||
|
public JDA getJda() {
|
||||||
|
if (jda == null) {
|
||||||
|
String discordToken = System.getProperty("DISCORD_TOKEN");
|
||||||
|
if (discordToken == null) {
|
||||||
|
log.error("Discord token not found, put it in the DISCORD_TOKEN environment variable");
|
||||||
|
System.exit(1);
|
||||||
|
}
|
||||||
|
start(discordToken);
|
||||||
|
try {
|
||||||
|
jda.awaitReady();
|
||||||
|
} catch (InterruptedException e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return jda;
|
||||||
|
}
|
||||||
|
|
||||||
public synchronized void start(String token) {
|
public synchronized void start(String token) {
|
||||||
if (jda != null) {
|
if (jda != null) {
|
||||||
return;
|
return;
|
||||||
|
|
|
||||||
|
|
@ -41,15 +41,15 @@
|
||||||
@if (currentPageIndex === 2) {
|
@if (currentPageIndex === 2) {
|
||||||
<section class="formPage">
|
<section class="formPage">
|
||||||
<div class="description">
|
<div class="description">
|
||||||
<p>Please enter your discord id below.</p>
|
<p>Please enter your Discord ID below.</p>
|
||||||
<p>You can find your discord id by going to User settings -> Advanced -> Developer Mode and turning it
|
<p>You can find your Discord ID by going to User settings -> Advanced -> Developer Mode and turning it
|
||||||
on</p>
|
on</p>
|
||||||
<p>With Developer Mode on in Discord click your profile in the bottom left and click Copy User Id</p>
|
<p>With Developer Mode on in Discord click your profile in the bottom left and click Copy User ID</p>
|
||||||
<p>We use this to find your punishment on our Discord server.</p>
|
<p>We use this to find your punishment on our Discord server.</p>
|
||||||
</div>
|
</div>
|
||||||
<mat-form-field appearance="fill">
|
<mat-form-field appearance="fill">
|
||||||
<mat-label>Discord Id</mat-label>
|
<mat-label>Discord Id</mat-label>
|
||||||
<input matInput placeholder="Discord Id" [(ngModel)]="discordId"
|
<input matInput placeholder="Discord ID" [(ngModel)]="discordId"
|
||||||
maxlength="17" minlength="18" pattern="^[0-9]+$">
|
maxlength="17" minlength="18" pattern="^[0-9]+$">
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
<button mat-raised-button (click)="checkPunishment()" [disabled]="authService.username() == null">
|
<button mat-raised-button (click)="checkPunishment()" [disabled]="authService.username() == null">
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user