From ca50deef5f96ffa26de8c1c362ac1070493e18e6 Mon Sep 17 00:00:00 2001 From: HappyTanuki Date: Fri, 8 May 2026 16:21:07 +0900 Subject: [PATCH] =?UTF-8?q?2026-05-08=EA=B8=B0=EC=A4=80=20=EB=8F=99?= =?UTF-8?q?=EC=9E=91=ED=95=98=EB=8F=84=EB=A1=9D=20=ED=94=BD=EC=8A=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CMakeLists.txt | 7 +++--- Dockerfile | 3 ++- include/Utils/VersionsCheckUtils.hpp | 34 +++++++++++++++------------- src/Commands/Delete.cpp | 6 ++--- src/Commands/Leave.cpp | 6 ++--- src/Commands/Play.cpp | 8 +++---- src/Commands/Queue.cpp | 2 +- src/Commands/Skip.cpp | 2 +- 8 files changed, 36 insertions(+), 32 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 096f9ed..469f61f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -15,7 +15,8 @@ aux_source_directory("src/Utils" settings) add_executable(${BOT_NAME} ${coresrc} ${commands} ${settings}) set(CMAKE_POSITION_INDEPENDENT_CODE ON) -set(CMAKE_BUILD_TYPE Debug) +# set(CMAKE_BUILD_TYPE Debug) +set(CMAKE_BUILD_TYPE Release) set(CMAKE_CXX_STANDARD 20) set(CMAKE_CXX_STANDARD_REQUIRED ON) @@ -38,9 +39,9 @@ target_link_libraries(${BOT_NAME} ogg oggz ${CMAKE_THREAD_LIBS_INIT} - ${OPENSSL_CRYPTO_LIBRARY} + ${OPENSSL_CRYPTO_LIBRARY} ${OPENSSL_SSL_LIBRARY} ${Boost_LIBRARIES} ) -link_directories(/usr/lib) \ No newline at end of file +link_directories(/usr/lib) diff --git a/Dockerfile b/Dockerfile index 830863b..9026d33 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,10 +1,11 @@ FROM debian:sid WORKDIR / RUN apt-get update && \ - apt-get install -y curl libopus0 tini liboggz2 xz-utils ffmpeg python3 \ + apt-get install -y curl libopus0 tini liboggz2 xz-utils ffmpeg python3 p7zip-full \ python3-pip python3-certifi python3-brotli python3-websockets python3-requests python3-mutagen && \ apt-get clean && \ rm -rf /var/lib/apt/lists/* +RUN curl -fsSL https://deno.land/install.sh | sh RUN pip3 install --break-system-packages --no-cache-dir curl_cffi RUN pip3 install --break-system-packages --no-cache-dir pycryptodome RUN curl -Lo dpp.deb https://dl.dpp.dev/ diff --git a/include/Utils/VersionsCheckUtils.hpp b/include/Utils/VersionsCheckUtils.hpp index 2be15fa..b3824a7 100644 --- a/include/Utils/VersionsCheckUtils.hpp +++ b/include/Utils/VersionsCheckUtils.hpp @@ -17,8 +17,9 @@ public: static void validateFFMPEG(std::shared_ptr cluster) { std::queue result = ConsoleUtils::safe_execute_command(SettingsManager::getFFMPEG_CMD(), {"-version"}); - std::string front = result.front(); - if (front[0] != 'f' || + std::string front = result.empty() ? "" : result.front(); + if (front.size() < 6 || + front[0] != 'f' || front[1] != 'f' || front[2] != 'm' || front[3] != 'p' || @@ -26,12 +27,12 @@ public: front[5] != 'g') { cluster->log(dpp::ll_warning, "ffmpeg is unavailable. downloading ffmpeg..."); - if (!isThereCMD(cluster, "curl")) { - exit(1); - } - if (!isThereCMD(cluster, "tar")) { - exit(1); - } + // if (!isThereCMD(cluster, "curl")) { + // exit(1); + // } + // if (!isThereCMD(cluster, "tar")) { + // exit(1); + // } system("curl -LO https://github.com/BtbN/FFmpeg-Builds/releases/latest/download/ffmpeg-master-latest-linux64-gpl.tar.xz"); system("tar -xf ffmpeg-master-latest-linux64-gpl.tar.xz"); @@ -44,19 +45,20 @@ public: static void validateYTDLP(std::shared_ptr cluster) { std::queue result = ConsoleUtils::safe_execute_command(SettingsManager::getYTDLP_CMD(), {"--version"}); - std::string front = result.front(); - if ((front[0]-'0' < 0 || front[0]-'0' > 9) || + std::string front = result.empty() ? "" : result.front(); + if (front.size() < 4 || + (front[0]-'0' < 0 || front[0]-'0' > 9) || (front[1]-'0' < 0 || front[1]-'0' > 9) || (front[2]-'0' < 0 || front[2]-'0' > 9) || (front[3]-'0' < 0 || front[3]-'0' > 9)) { cluster->log(dpp::ll_warning, "ytdlp is unavailable. downloading ytdlp..."); - if (!isThereCMD(cluster, "curl")) { - exit(1); - } - if (!isThereCMD(cluster, "tar")) { - exit(1); - } + // if (!isThereCMD(cluster, "curl")) { + // exit(1); + // } + // if (!isThereCMD(cluster, "tar")) { + // exit(1); + // } system("curl -LO https://github.com/yt-dlp/yt-dlp/releases/latest/download/yt-dlp"); system("chmod +x ./yt-dlp"); diff --git a/src/Commands/Delete.cpp b/src/Commands/Delete.cpp index a6dc4db..a9aacc3 100644 --- a/src/Commands/Delete.cpp +++ b/src/Commands/Delete.cpp @@ -11,14 +11,14 @@ namespace bumbleBee::commands { return; } - dpp::voiceconn* v = event.from->get_voice(event.command.guild_id); + dpp::voiceconn* v = event.from()->get_voice(event.command.guild_id); std::shared_ptr removed; - + if (!v) // v-> 로 nullptr을 참조하면 안 되므로. removed = musicManager->remove(event.command.guild_id, nullptr, pos); else - removed = musicManager->remove(event.command.guild_id, v->voiceclient, pos); + removed = musicManager->remove(event.command.guild_id, v->voiceclient.get(), pos); dpp::message msg("다음 항목을 큐에서 삭제했습니다!:"); msg.add_embed(removed->embed); diff --git a/src/Commands/Leave.cpp b/src/Commands/Leave.cpp index e08d225..7745d77 100644 --- a/src/Commands/Leave.cpp +++ b/src/Commands/Leave.cpp @@ -2,7 +2,7 @@ namespace bumbleBee::commands { void Leave::execute(const dpp::slashcommand_t &event) { - dpp::voiceconn* v = event.from->get_voice(event.command.guild_id); + dpp::voiceconn* v = event.from()->get_voice(event.command.guild_id); if (!v || !v->voiceclient || !v->voiceclient->is_ready()) { event.edit_original_response(dpp::message("현재 음성 채팅방에 있는 상태가 아닙니다!")); @@ -12,8 +12,8 @@ namespace bumbleBee::commands { v->voiceclient->stop_audio(); v->voiceclient->pause_audio(true); - event.from->clear_queue(); - event.from->disconnect_voice(event.command.guild_id); + event.from()->clear_queue(); + event.from()->disconnect_voice(event.command.guild_id); event.edit_original_response(dpp::message("음성 채팅방을 떠납니다!")); } diff --git a/src/Commands/Play.cpp b/src/Commands/Play.cpp index 19198ce..3edc2d7 100644 --- a/src/Commands/Play.cpp +++ b/src/Commands/Play.cpp @@ -19,7 +19,7 @@ namespace bumbleBee::commands { event.reply("노래를 재생하려면 검색어 또는 링크를 입력해 주십시오."); return; } - if (!event.from->get_voice(event.command.guild_id) && !g->connect_member_voice(event.command.usr.id)) { + if (!event.from()->get_voice(event.command.guild_id) && !g->connect_member_voice(*event.from()->creator, event.command.usr.id)) { event.edit_original_response(dpp::message("노래를 재생할 음성 채팅방에 먼저 참가하고 신청해야 합니다!")); return; } @@ -202,14 +202,14 @@ namespace bumbleBee::commands { event.command.channel_id, query, event.command.usr, - event.from->creator, + event.from()->creator, musicManager); t.detach(); } if (!musics.empty()) { - event.from->creator->log(dpp::ll_info, "Enqueuing " + musics.front()->embed.title + " - " + musics.front()->id); + event.from()->creator->log(dpp::ll_info, "Enqueuing " + musics.front()->embed.title + " - " + musics.front()->id); musicManager->queue_music(event.command.guild_id, musics.front()); msg.add_embed(musics.front()->embed); musics.pop(); @@ -223,7 +223,7 @@ namespace bumbleBee::commands { } if (musicManager->getNowPlaying(event.command.guild_id).id == "") { - dpp::voiceconn* v = event.from->get_voice(event.command.guild_id); + dpp::voiceconn* v = event.from()->get_voice(event.command.guild_id); if (!v || !v->voiceclient || !v->voiceclient->is_ready()) { event.edit_original_response(dpp::message("현재 음성 채팅방에 있는 상태가 아닙니다!")); diff --git a/src/Commands/Queue.cpp b/src/Commands/Queue.cpp index 5c64f6b..195e08a 100644 --- a/src/Commands/Queue.cpp +++ b/src/Commands/Queue.cpp @@ -64,7 +64,7 @@ namespace bumbleBee::commands { messageSentCondition.wait(lock, [&](){ return messagesent; }); queued.pop(); } - }, queued, event.command.channel_id, event.from->creator); + }, queued, event.command.channel_id, event.from()->creator); t.detach(); } diff --git a/src/Commands/Skip.cpp b/src/Commands/Skip.cpp index f1b6244..cd1bc26 100644 --- a/src/Commands/Skip.cpp +++ b/src/Commands/Skip.cpp @@ -2,7 +2,7 @@ namespace bumbleBee::commands { void Skip::execute(const dpp::slashcommand_t &event) { - dpp::voiceconn* v = event.from->get_voice(event.command.guild_id); + dpp::voiceconn* v = event.from()->get_voice(event.command.guild_id); if (!v || !v->voiceclient || !v->voiceclient->is_ready()) { event.edit_original_response(dpp::message("스킵하려면 음악을 재생중이어야 합니다!"));