임시저장

This commit is contained in:
2024-08-22 10:41:22 +09:00
parent 0633855374
commit 68b6105ac3
4 changed files with 38 additions and 31 deletions

View File

@@ -23,6 +23,16 @@ BumbleCeepp::BumbleCeepp(std::string token, std::string DBURL, std::string DBID,
botCluster->on_voice_track_marker([&](const dpp::voice_track_marker_t &marker)
{
marker.voice_client->log(dpp::loglevel::ll_debug, "nowPlaying " + nowPlayingMusic);
std::shared_ptr<dpp::embed> embed;
if (nowPlayingMusic == "") {
nowPlayingMusic = marker.track_meta;
embed = findEmbed(nowPlayingMusic);
}
else {
embed = findEmbed(nowPlayingMusic);
nowPlayingMusic = marker.track_meta;
}
auto voice_members = dpp::find_guild(marker.voice_client->server_id)->voice_members;
dpp::snowflake connectedChannel = marker.voice_client->channel_id;
int memberCount = 0;
@@ -63,21 +73,12 @@ BumbleCeepp::BumbleCeepp(std::string token, std::string DBURL, std::string DBID,
}
if (repeat) {
std::shared_ptr<dpp::embed> embed;
if (nowPlayingMusic == "") {
nowPlayingMusic = marker.track_meta;
if (!embed) {
botCluster->log(dpp::loglevel::ll_error, std::string("알 수 없는 오류 발생!"));
return;
}
else {
embed = findEmbed(nowPlayingMusic);
nowPlayingMusic = marker.track_meta;
if (!embed) {
botCluster->log(dpp::loglevel::ll_error, std::string("알 수 없는 오류 발생!"));
return;
}
enqueueMusic({nowPlayingMusic, *embed}, marker.voice_client);
}
enqueueMusic({nowPlayingMusic, *embed}, marker.voice_client);
}
});
}

View File

@@ -68,8 +68,7 @@ void commands::Play::operator()(const dpp::slashcommand_t& event)
event.edit_response("검색 결과가 없습니다.");
return;
}
event.from->log(dpp::loglevel::ll_debug, "musicIDs: " + musicIDs);
std::stringstream sstream(musicIDs);
std::string musicID;
while (getline(sstream, musicID, '\n')) {

View File

@@ -17,11 +17,11 @@ void commands::Queue::operator()(const dpp::slashcommand_t& event) {
auto voiceconn = event.from->get_voice(event.command.guild_id);
if (!voiceconn || !voiceconn->voiceclient)
if (!voiceconn || !voiceconn->voiceclient) {
event.reply("음성 채팅방에 참가하지 않은 상태입니다.");
return;
}
auto vc = voiceconn->voiceclient;
std::vector<std::string> queuedSongs = vc->get_marker_metadata();
int remainingSongsCount = vc->get_tracks_remaining() - 1;
if (remainingSongsCount <= 0 && !vc->is_playing()) {
@@ -42,12 +42,18 @@ void commands::Queue::operator()(const dpp::slashcommand_t& event) {
msg.add_embed(curMusicEmbed);
}
event.reply(msg, [&](const dpp::confirmation_callback_t &_event) {
event.reply(msg, [&](const dpp::confirmation_callback_t& _event) {
auto shard_id = dpp::find_guild(event.command.guild_id)->shard_id;
dpp::cluster* cluster = const_cast<dpp::cluster *>(_event.bot);
auto shard = cluster->get_shard(shard_id);
auto iter = shard->connecting_voice_channels.find(event.command.guild_id);
std::vector<std::string> queuedSongs = iter->second->voiceclient->get_marker_metadata();
int j;
for (int i = 0; i < (queuedSongs.size()+4) / 5; i++)
{
dpp::embed followEmbed = dpp::embed();
int j;
for (j = i; j < i + 5 && j < queuedSongs.size(); j++)
for (j = i * 5; j < i * 5 + 5 && j < queuedSongs.size(); j++)
{
dpp::embed originalEmbed = *Bot->findEmbed(queuedSongs[j]);
@@ -66,7 +72,8 @@ void commands::Queue::operator()(const dpp::slashcommand_t& event) {
""
);
}
if (j == queuedSongs.size())
if (j >= queuedSongs.size())
{
followEmbed.set_timestamp(time(0));
if (Bot->repeat)

View File

@@ -30,17 +30,17 @@ if uri_validator(sys.argv[1]) == True:
IDlist = set(pattern.findall(response.text))
list_to_return = list()
list_to_return.append(IDlist[0])
list_to_return_count = 0
for it in range(1, len(list_to_return)):
if (list_to_return[list_to_return_count] == IDlist[it]):
continue
else:
list_to_return[list_to_return_count] = IDlist[it]
list_to_return_count += 1
# list_to_return = list()
# list_to_return.append(IDlist[0])
# list_to_return_count = 0
# for it in range(0, len(list_to_return)):
# if (list_to_return[list_to_return_count] == IDlist[it]):
# continue
# else:
# list_to_return[list_to_return_count] = IDlist[it]
# list_to_return_count += 1
for it in list_to_return:
for it in IDlist:
print(it)
#영상인 경우
elif result.path == '/watch':