데이터베이스 연결 추가됨

This commit is contained in:
HappyTanuki committed 2024-10-18 22:21:02 +09:00
1 parent 68b6105ac3
commit c276065a65
5 files changed
+138 -2

No files matched your search

+49
View File
@@ -0,0 +1,49 @@
W8UNLOOogU4
749DIRUHhNY
o75PUTiHEXU
pS5d77DQHOI
65xX7zyr-fA
2eNEQ0cQtkI
UgS7vgquBvo
IFCDLIKSArs
yPdqcADl5U4
6aEglYFwjrA
n8F-E5f-cos
1zwaZkOXXqw
vjSrFwbwu6w
vwZAqxL8rgs
zOkIe3RcTCs
mzVbYUBo8_Y
rgNdeflYdYw
CjaM8qWzssk
kNDbaYEp0tU
smObR_8q5UQ
27NtZwyog7g
vHfAjfKVMew
b_bjtIeqIR4
YTaX7BWlk9g
BBj3SCImk_A
Yb_IhN4TGp8
-m-crWZHLi0
4ciZKNHSoUs
4tlUwgtgdZA
oPGtAA2HaS8
dLlD-dZNACM
9LW9DpmhrPE
pMTRBNMX2mw
Kt451YtL-Vs
tc0FL9JROGQ
NinLIDs9qmU
KMdTrqzEI0I
HbXaUmWaU5Q
xtFAmapbTbY
B7luArOaIl0
HMqhXxH5-RQ
mQFokUq9LYs
HyL8Z94W6es
prAnOH-q_Bo
LRPGqNeav_M
M4-XU0a2hf0
BryspbM6s3E
JVTS3fyoAEQ
KAaUyVJoNAE
+1 -1
View File
@@ -1 +1 @@
{"id": "\uc694\uc544\uc18c\ube44 \uad34\ubb3c", "title": "\uc694\uc544\uc18c\ube44 \uad34\ubb3c", "_type": "playlist", "entries": [{"id": "8Anx6VQeT4k", "title": "\uc81c\uc815\uc2e0\uc774 \uc544\ub2c8\uc57c\ud83d\ude08: YOASOBI - \uad34\ubb3c(\u602a\u7269, Monster) [\uac00\uc0ac/\ubc1c\uc74c/\ud55c\uae00 \uc790\ub9c9] [\ube44\uc2a4\ud0c0\uc988 2\uae30 op]", "formats": [{"format_id": "sb3", "format_note": "storyboard", "ext": "mhtml", "protocol": "mhtml", "acodec": "none", "vcodec": "none", "url": "https://i.ytimg.com/sb/8Anx6VQeT4k/storyboard3_L0/default.jpg?sqp=-oaymwENSDfyq4qpAwVwAcABBqLzl_8DBgiOxrqoBg==&sigh=rs$AOn4CLAkMRRaulLY2Ut3hVR7lrkLSPdqkA", "width": 48, "height": 27, "fps": 0.4830917874396135, "rows": 10, "columns": 10, "fragments": [{"url": "https://i.ytimg.com/sb/8Anx6VQeT4k/storyboard3_L0/default.jpg?sqp=-oaymwENSDfyq4qpAwVwAcABBqLzl_8DBgiOxrqoBg==&sigh=rs$AOn4CLAkMRRaulLY2Ut3hVR7lrkLSPdqkA", "duration": 207.0}], "resolution": "48x27", "aspect_ratio": 1.78, "filesize_approx": null, "http_headers": {"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.101 Safari/537.36", "Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8", "Accept-Language": "en-us,en;q=0.5", "Sec-Fetch-Mode": "navigate"}, "audio_ext": "none", "video_ext": "none", "vbr": 0, "abr": 0, "tbr": null, "format": "sb3 - 48x27 (storyboard)"}, {"format_id": "sb2", "format_note": "storyboard", "ext": "mhtml", "protocol": "mhtml", "acodec": "none", "vcodec": "none", "url": "https://i.ytimg.com/sb/8Anx6VQeT4k/storyboard3_L1/M$M.jpg?sqp=-oaymwENSDfyq4qpAwVwAcABBqLzl_8DBgiOxrqoBg==&sigh=rs$AOn4CLASmUjf_Wb7Q1IRBpENbpmZihgrIg", "width": 80, "height": 45, "fps": 0.5072463768115942, "rows": 10, "columns": 10, "fragments": [{"url": "https://i.ytimg.com/sb/8Anx6VQeT4k/storyboard3_L1/M0.jpg?sqp=-oaymwENSDfyq4qpAwVwAcABBqLzl_8DBgiOxrqoBg==&sigh=rs$AOn4CLASmUjf_Wb7Q1IRBpENbpmZihgrIg", "duration": 197.14285714285714}, {"url": "https://i.ytimg.com/sb/8Anx6VQeT4k/storyboard3_L1/M1.jpg?sqp=-oaymwENSDfyq4qpAwVwAcABBqLzl_8DBgiOxrqoBg==&sigh=rs$AOn4CLASmUjf_Wb7Q1IRBpENbpmZihgrIg", "duration": 9.857142857142861}], "resolution": "80x45", "aspect_ratio": 1.78, "filesize_approx": null, "http_headers": {"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.101 Safari/537.36", "Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8", "Accept-Language": "en-us,en;q=0.5", "Sec-Fetch-Mode": "navigate"}, "audio_ext": "none", "video_ext": "none", "vbr": 0, "abr": 0, "tbr": null, "format": "sb2 - 80x45 (storyboard)"}, {"format_id": "sb1", "format_note": "storyboard", "ext": "mhtml", "protocol": "mhtml", "acodec": "none", "vcodec": "none", "url": "https://i.ytimg.com/sb/8Anx6VQeT4k/storyboard3_L2/M$M.jpg?sqp=-oaymwENSDfyq4qpAwVwAcABBqLzl_8DBgiOxrqoBg==&sigh=rs$AOn4CLBVR3efefwhNfi7A9d60EtcpE0upg", "width": 160, "height": 90, "fps": 0.5072463768115942, "rows": 5, "columns": 5, "fragments": [{"url": "https://i.ytimg.com/sb/8Anx6VQeT4k/storyboard3_L2/M0.jpg?sqp=-oaymwENSDfyq4qpAwVwAcABBqLzl_8DBgiOxrqoBg==&sigh=rs$AOn4CLBVR3efefwhNfi7A9d60EtcpE0upg", "duration": 49.285714285714285}, {"url": "https://i.ytimg.com/sb/8Anx6VQeT4k/storyboard3_L2/M1.jpg?sqp=-oaymwENSDfyq4qpAwVwAcABBqLzl_8DBgiOxrqoBg==&sigh=rs$AOn4CLBVR3efefwhNfi7A9d60EtcpE0upg", "duration": 49.285714285714285}, {"url": "https://i.ytimg.com/sb/8Anx6VQeT4k/storyboard3_L2/M2.jpg?sqp=-oaymwENSDfyq4qpAwVwAcABBqLzl_8DBgiOxrqoBg==&sigh=rs$AOn4CLBVR3efefwhNfi7A9d60EtcpE0upg", "duration": 49.285714285714285}, {"url": "https://i.ytimg.com/sb/8Anx6VQeT4k/storyboard3_L2/M3.jpg?sqp=-oaymwENSDfyq4qpAwVwAcABBqLzl_8DBgiOxrqoBg==&sigh=rs$AOn4CLBVR3efefwhNfi7A9d60EtcpE0upg", "duration": 49.285714285714285}, {"url": "https://i.ytimg.com/sb/8Anx6VQeT4k/storyboard3_L2/M4.jpg?sqp=-oaymwENSDfyq4qpAwVwAcABBqLzl_8DBgiOxrqoBg==&sigh=rs$AOn4CLBVR3efefwhNfi7A9d60EtcpE0upg", "duration": 9.857142857142861}], "resolution": "160x90", "aspect_ratio": 1.78, "filesize_approx": null, "http_headers": {"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.101 Safari/537.36", "Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8", "Accept-Language": "en-us,en;q=0.5", "Sec-Fetch-Mode": "navigate"}, "audio_ext": "none", "video_ext": "none", "vbr": 0, "abr": 0, "tbr": null, "format": "sb1 - 160x90 (storyboard)"}, {"format_id": "sb0", "format_note": "storyboard", "ext": "mhtml", "protocol": "mhtml", "acodec": "none", "vcodec": "none", "url": "https://i.ytimg.com/sb/8Anx6VQeT4k/storyboard3_L3/M$M.jpg?sqp=-oaymwENSDfyq4qpAwVwAcABBqLzl_8DBgiOxrqoBg==&sigh=rs$AOn4CLB_Fh-CwvmJtr9fwCfuTkKyEYq1XA", "width": 320, "height": 180, "fps": 0.5072463768115942, "rows": 3, "columns": 3, "fragments": [{"url": "https://i.ytimg.com/sb/8Anx6VQeT4k/storyboard3_L3/M0.jpg?sqp=-oaymwENSDfyq4qpAwVwAcABBqLzl_8DBgiOxrqoBg==&sigh=rs$AOn4CLB_Fh-CwLine truncated
{"id": "PL5NSTAfQ-wQBqZYMTqxADemyUW8mxJq2h", "title": "Discord bot playlist", "availability": "public", "channel_follower_count": null, "description": "", "tags": [], "thumbnails": [{"url": "https://i.ytimg.com/vi/W8UNLOOogU4/hqdefault.jpg?sqp=-oaymwEWCKgBEF5IWvKriqkDCQgBFQAAiEIYAQ==&rs=AOn4CLBFfr8gp0AtEeh6QezeCaAoeldSHA", "height": 94, "width": 168, "id": "0", "resolution": "168x94"}, {"url": "https://i.ytimg.com/vi/W8UNLOOogU4/hqdefault.jpg?sqp=-oaymwEWCMQBEG5IWvKriqkDCQgBFQAAiEIYAQ==&rs=AOn4CLAPBEppO99jRTeR8BzZv2fRk3yaYA", "height": 110, "width": 196, "id": "1", "resolution": "196x110"}, {"url": "https://i.ytimg.com/vi/W8UNLOOogU4/hqdefault.jpg?sqp=-oaymwEXCPYBEIoBSFryq4qpAwkIARUAAIhCGAE=&rs=AOn4CLBFYpaV_Q_R_G9NtvjNxyzCAI5SGg", "height": 138, "width": 246, "id": "2", "resolution": "246x138"}, {"url": "https://i.ytimg.com/vi/W8UNLOOogU4/hqdefault.jpg?sqp=-oaymwEXCNACELwBSFryq4qpAwkIARUAAIhCGAE=&rs=AOn4CLBkk4PV7dT4LvFzlwj8hQ1rpenmKg", "height": 188, "width": 336, "id": "3", "resolution": "336x188"}], "modified_date": "20240812", "view_count": null, "playlist_count": 49, "channel": "\uae40\ubbfc\uc218", "channel_id": "UCwLZoiacDAC3cV8uGLh_LYg", "uploader_id": "@happytanuki500", "uploader": "\uae40\ubbfc\uc218", "channel_url": "https://www.youtube.com/channel/UCwLZoiacDAC3cV8uGLh_LYg", "uploader_url": "https://www.youtube.com/@happytanuki500", "_type": "playlist", "entries": [{"id": "W8UNLOOogU4", "title": "\u81ea\u7531\u306e\u7ffc", "formats": [{"format_id": "sb3", "format_note": "storyboard", "ext": "mhtml", "protocol": "mhtml", "acodec": "none", "vcodec": "none", "url": "https://i.ytimg.com/sb/W8UNLOOogU4/storyboard3_L0/default.jpg?sqp=-oaymwENSDfyq4qpAwVwAcABBqLzl_8DBgii0-CpBg==&sigh=rs$AOn4CLDcLOIRbRjCi2PlrwiQR1CN6RPsRw", "width": 48, "height": 27, "fps": 0.3048780487804878, "rows": 10, "columns": 10, "fragments": [{"url": "https://i.ytimg.com/sb/W8UNLOOogU4/storyboard3_L0/default.jpg?sqp=-oaymwENSDfyq4qpAwVwAcABBqLzl_8DBgii0-CpBg==&sigh=rs$AOn4CLDcLOIRbRjCi2PlrwiQR1CN6RPsRw", "duration": 328.0}], "resolution": "48x27", "aspect_ratio": 1.78, "filesize_approx": null, "http_headers": {"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/95.0.4638.17 Safari/537.36", "Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8", "Accept-Language": "en-us,en;q=0.5", "Sec-Fetch-Mode": "navigate"}, "audio_ext": "none", "video_ext": "none", "vbr": 0, "abr": 0, "tbr": null, "format": "sb3 - 48x27 (storyboard)"}, {"format_id": "sb2", "format_note": "storyboard", "ext": "mhtml", "protocol": "mhtml", "acodec": "none", "vcodec": "none", "url": "https://i.ytimg.com/sb/W8UNLOOogU4/storyboard3_L1/M$M.jpg?sqp=-oaymwENSDfyq4qpAwVwAcABBqLzl_8DBgii0-CpBg==&sigh=rs$AOn4CLAGBAf95T93u8ydq2YF3t-4adpMsw", "width": 45, "height": 45, "fps": 0.20426829268292682, "rows": 10, "columns": 10, "fragments": [{"url": "https://i.ytimg.com/sb/W8UNLOOogU4/storyboard3_L1/M0.jpg?sqp=-oaymwENSDfyq4qpAwVwAcABBqLzl_8DBgii0-CpBg==&sigh=rs$AOn4CLAGBAf95T93u8ydq2YF3t-4adpMsw", "duration": 328.0}], "resolution": "45x45", "aspect_ratio": 1.0, "filesize_approx": null, "http_headers": {"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/95.0.4638.17 Safari/537.36", "Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8", "Accept-Language": "en-us,en;q=0.5", "Sec-Fetch-Mode": "navigate"}, "audio_ext": "none", "video_ext": "none", "vbr": 0, "abr": 0, "tbr": null, "format": "sb2 - 45x45 (storyboard)"}, {"format_id": "sb1", "format_note": "storyboard", "ext": "mhtml", "protocol": "mhtml", "acodec": "none", "vcodec": "none", "url": "https://i.ytimg.com/sb/W8UNLOOogU4/storyboard3_L2/M$M.jpg?sqp=-oaymwENSDfyq4qpAwVwAcABBqLzl_8DBgii0-CpBg==&sigh=rs$AOn4CLAUHAXrqJWQJyk8WboF69MUFSEJaw", "width": 90, "height": 90, "fps": 0.20426829268292682, "rows": 5, "columns": 5, "fragments": [{"url": "https://i.ytimg.com/sb/W8UNLOOogU4/storyboard3_L2/M0.jpg?sqp=-oaymwENSDfyq4qpAwVwAcABBqLzl_8DBgii0-CpBg==&sigh=rs$AOn4CLAUHAXrqJWQJyk8WboF69MUFSEJaw", "duration": 122.38805970149254}, {"url": "https://i.ytimg.com/sb/W8UNLOOogU4/storyboard3_L2/M1.jpg?sqp=-oaymwENSDfyq4qpAwVwAcABBqLzl_8DBgii0-CpBg==&sigh=rs$AOn4CLAUHAXrqJWQJyk8WboF69MUFSEJaw", "duration": 122.38805970149254}, {"url": "https://i.ytimg.com/sb/W8UNLOOogU4/storyboard3_L2/M2.jpg?sqp=-oaymwENSDfyq4qpAwVwAcABBqLzl_8DBgii0-CpBg==&sigh=rs$AOn4CLAUHAXrqJWQJyk8WboF69MUFSEJaw", "duration": 83.22388059701493}], "resolution": "90x90", "aspect_ratio": 1.0, "filesize_approx": null, "http_headers": {"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/95.0.4638.17 Safari/537.36", "Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8", "Accept-Language": "en-us,en;q=0.5", "Sec-Fetch-Mode": "navigate"}, "audio_ext": "none", "video_ext": "none", "vbr": 0, "abr": 0, "tbr": null, "format": "sb1 - 90x90 (storyboard)"}, {"format_id": Line truncated
+24
View File
@@ -49,6 +49,12 @@ BumbleCeepp::BumbleCeepp(std::string token, std::string DBURL, std::string DBID,
return;
}
<<<<<<< HEAD
if (!memberCount)
{
auto joinedShard = marker.from;
marker.voice_client->log(dpp::loglevel::ll_info, "voicechat is empty.");
=======
marker.voice_client->log(dpp::loglevel::ll_debug, "Playing " + marker.track_meta + "on channel id " + marker.voice_client->channel_id.str() + ".");
int remainingSongsCount = marker.voice_client->get_tracks_remaining();
@@ -66,15 +72,33 @@ BumbleCeepp::BumbleCeepp(std::string token, std::string DBURL, std::string DBID,
enqueueMusic({nowPlayingMusic, *embed}, marker.voice_client);
}
else {
>>>>>>> 68b6105ac3ddf1c27f40e0e552780171352e734d
marker.voice_client->stop_audio();
joinedShard->disconnect_voice(marker.voice_client->server_id);
return;
}
}
<<<<<<< HEAD
marker.voice_client->log(dpp::loglevel::ll_debug, "Playing " + marker.track_meta + "on channel id " + marker.voice_client->channel_id.str() + ".");
int remainingSongsCount = marker.voice_client->get_tracks_remaining();
marker.voice_client->log(dpp::loglevel::ll_info, "Marker count : " + remainingSongsCount);
if (remainingSongsCount <= 1 && !marker.voice_client->is_playing())
{
auto joinedShard = marker.from;
marker.voice_client->log(dpp::loglevel::ll_info, "Queue ended");
if (!joinedShard)
return;
marker.voice_client->stop_audio();
joinedShard->disconnect_voice(marker.voice_client->server_id);
=======
if (repeat) {
if (!embed) {
botCluster->log(dpp::loglevel::ll_error, std::string("알 수 없는 오류 발생!"));
>>>>>>> 68b6105ac3ddf1c27f40e0e552780171352e734d
return;
}
+1 -1
View File
@@ -28,7 +28,7 @@ void commands::Delete::operator()(const dpp::slashcommand_t& event)
int remainingSongsCount = vc->get_tracks_remaining() - 1;
std::vector<std::string> queuedSongs = vc->get_marker_metadata();
vc->log(dpp::loglevel::ll_trace, "Queue size : " + remainingSongsCount);
vc->log(dpp::loglevel::ll_info, "Queue size : " + remainingSongsCount);
if (index < 0 || remainingSongsCount+1 < index || (!vc->is_playing() && index == 0)) {
std::cout << "invalid index : " << index << ", " + Pos + "\n";
+63
View File
@@ -4,6 +4,7 @@
#include <string>
#include <filesystem>
#include <ctime>
#include <thread>
using json = nlohmann::json;
@@ -34,6 +35,14 @@ commands::Play::Play(dpp::snowflake botID, BumbleCeepp* Bot)
commandObjectVector.push_back(command);
}
<<<<<<< HEAD
static void _Internal_Enqueue_Func(const dpp::slashcommand_t& event, BumbleCeepp* Bot){
std::string Query = std::get<std::string>(event.get_parameter("query"));
event.from->log(dpp::loglevel::ll_info, "음악 다운로드 시작");
std::system(("python3 yt-download.py \"" + Query + "\" & wait").c_str());
event.from->log(dpp::loglevel::ll_info, "음악 다운로드 완료");
=======
void commands::Play::operator()(const dpp::slashcommand_t& event)
{
if (std::holds_alternative<std::monostate>(event.get_parameter("query")))
@@ -59,14 +68,35 @@ void commands::Play::operator()(const dpp::slashcommand_t& event)
event.thinking();
event.from->log(dpp::loglevel::ll_debug, "음악 ID 쿼리: " + Query);
>>>>>>> 68b6105ac3ddf1c27f40e0e552780171352e734d
std::string musicIDs = getResultFromCommand(("python3 youtube-search.py \"" + Query + "\" & wait").c_str());
if (!musicIDs.length())
{
<<<<<<< HEAD
event.from->log(dpp::loglevel::ll_info, "Red ID : " + ID);
infofile.open("Music/" + ID + ".info.json");
infofile >> document;
infofile.close();
FQueueElement Data = {
ID,
Bot->makeEmbed(
document["webpage_url"],
document["title"],
document["uploader"],
document["id"],
document["thumbnail"],
int(document["duration"]))
};
RequestedMusic.push(Data);
=======
event.from->log(dpp::loglevel::ll_debug, "유튜브 검색 결과 없음");
event.edit_response("검색 결과가 없습니다.");
return;
>>>>>>> 68b6105ac3ddf1c27f40e0e552780171352e734d
}
std::stringstream sstream(musicIDs);
@@ -81,6 +111,15 @@ void commands::Play::operator()(const dpp::slashcommand_t& event)
event.from->log(dpp::loglevel::ll_debug, "다운로드 시작");
std::system(("python3 yt-download.py \"" + musicID + "\" & wait").c_str());
<<<<<<< HEAD
if (v && v->voiceclient && v->voiceclient->is_ready())
{
auto _copiedQueue = RequestedMusic;
while (!_copiedQueue.empty())
{
Bot->enqueueMusic(_copiedQueue.front(), v->voiceclient);
_copiedQueue.pop();
=======
event.from->log(dpp::loglevel::ll_debug, "musicID: " + musicID);
std::ifstream infofile;
infofile.open((std::string("Music/") + musicID + ".info.json").c_str());
@@ -102,6 +141,7 @@ void commands::Play::operator()(const dpp::slashcommand_t& event)
else {
event.from->log(dpp::loglevel::ll_debug, "DB쿼리 완료");
on_DLCompleted(musicID, *embed, event);
>>>>>>> 68b6105ac3ddf1c27f40e0e552780171352e734d
}
}
return;
@@ -135,6 +175,29 @@ void commands::Play::on_DLCompleted(std::string musicID, dpp::embed embed, const
event.from->creator->message_create(followMsg);
}
}
void commands::Play::operator()(const dpp::slashcommand_t& event)
{
if (std::holds_alternative<std::monostate>(event.get_parameter("query")))
{
event.reply("노래를 재생하려면 검색어 또는 링크를 입력해 주십시오.");
return;
}
/* Attempt to connect to a voice channel, returns false if we fail to connect. */
if (!event.from->get_voice(event.command.guild_id))
{
if (!dpp::find_guild(event.command.guild_id)->connect_member_voice(event.command.get_issuing_user().id))
{
return event.reply("노래를 재생할 음성 채팅방에 먼저 참가하고 신청해야 합니다!");
}
}
event.thinking();
std::thread t1(_Internal_Enqueue_Func, event, Bot);
t1.detach();
auto voiceconn = event.from->get_voice(event.command.guild_id);