mirror of
https://github.com/headporter81/DiscordDownloaderBot.git
synced 2026-12-06 07:41:10 +09:00
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
991044fe44
commit
93d815c7b5
1 file changed
+15
-2
@@ -9,6 +9,7 @@ import org.jetbrains.annotations.NotNull;
|
|||||||
|
|
||||||
import com.sun.net.httpserver.HttpExchange;
|
import com.sun.net.httpserver.HttpExchange;
|
||||||
import com.sun.net.httpserver.HttpServer;
|
import com.sun.net.httpserver.HttpServer;
|
||||||
|
import net.dv8tion.jda.api.exceptions.InvalidTokenException;
|
||||||
import net.dv8tion.jda.api.exceptions.ParsingException;
|
import net.dv8tion.jda.api.exceptions.ParsingException;
|
||||||
import net.dv8tion.jda.api.utils.data.DataArray;
|
import net.dv8tion.jda.api.utils.data.DataArray;
|
||||||
import net.dv8tion.jda.api.utils.data.DataObject;
|
import net.dv8tion.jda.api.utils.data.DataObject;
|
||||||
@@ -71,16 +72,28 @@ public class DiscordDownloadBot extends ListenerAdapter {
|
|||||||
System.exit(1);
|
System.exit(1);
|
||||||
}
|
}
|
||||||
new File(BASE_DOWNLOAD_DIR).mkdirs();
|
new File(BASE_DOWNLOAD_DIR).mkdirs();
|
||||||
try {
|
|
||||||
DiscordDownloadBot bot = new DiscordDownloadBot();
|
DiscordDownloadBot bot = new DiscordDownloadBot();
|
||||||
|
try {
|
||||||
bot.startHttpServer(); // 디스코드 로그인이 실패해도 홈페이지 창구는 살아 있도록 먼저 켬
|
bot.startHttpServer(); // 디스코드 로그인이 실패해도 홈페이지 창구는 살아 있도록 먼저 켬
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
// NAS가 막 켜졌을 땐 DNS가 아직 안 돼서 로그인이 실패함 → 1분마다 다시 시도 (토큰이 틀린 건 재시도해도 소용없으니 포기)
|
||||||
|
while (true) {
|
||||||
|
try {
|
||||||
JDABuilder.createDefault(BOT_TOKEN)
|
JDABuilder.createDefault(BOT_TOKEN)
|
||||||
.enableIntents(GatewayIntent.MESSAGE_CONTENT)
|
.enableIntents(GatewayIntent.MESSAGE_CONTENT)
|
||||||
.addEventListeners(bot)
|
.addEventListeners(bot)
|
||||||
.build();
|
.build();
|
||||||
System.out.println("🤖 봇 실행 완료! (더블 탭 전략)");
|
System.out.println("🤖 봇 실행 완료! (더블 탭 전략)");
|
||||||
|
return;
|
||||||
|
} catch (InvalidTokenException e) {
|
||||||
|
System.err.println("BOT_TOKEN이 올바르지 않습니다. 디스코드 로그인 포기 (HTTP 창구는 계속 동작)");
|
||||||
|
return;
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
System.err.println("⚠️ 디스코드 로그인 실패, 1분 뒤 다시 시도: " + e.getMessage());
|
||||||
|
try { Thread.sleep(60_000); } catch (InterruptedException ie) { return; }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user