mirror of
https://github.com/HappyTanuki/BumbleCee.git
synced 2025-10-26 01:45:15 +00:00
일단은 뭐.. 작동하네요..
This commit is contained in:
@@ -15,11 +15,11 @@ BumbleCeepp::BumbleCeepp(std::string token, std::string DBURL, std::string DBID,
|
|||||||
conn = sql::mariadb::get_driver_instance()->connect(DBURL, pro);
|
conn = sql::mariadb::get_driver_instance()->connect(DBURL, pro);
|
||||||
|
|
||||||
commandsArray.push_back(std::make_shared<commands::Play>(botCluster->me.id, this));
|
commandsArray.push_back(std::make_shared<commands::Play>(botCluster->me.id, this));
|
||||||
// commandsArray.push_back(std::make_shared<commands::Repeat>(botCluster->me.id, this));
|
commandsArray.push_back(std::make_shared<commands::Repeat>(botCluster->me.id, this));
|
||||||
// commandsArray.push_back(std::make_shared<commands::Queue>(botCluster->me.id, this));
|
commandsArray.push_back(std::make_shared<commands::Queue>(botCluster->me.id, this));
|
||||||
// commandsArray.push_back(std::make_shared<commands::Skip>(botCluster->me.id, this));
|
commandsArray.push_back(std::make_shared<commands::Skip>(botCluster->me.id, this));
|
||||||
// commandsArray.push_back(std::make_shared<commands::Leave>(botCluster->me.id, this));
|
commandsArray.push_back(std::make_shared<commands::Leave>(botCluster->me.id, this));
|
||||||
// commandsArray.push_back(std::make_shared<commands::Delete>(botCluster->me.id, this));
|
commandsArray.push_back(std::make_shared<commands::Delete>(botCluster->me.id, this));
|
||||||
|
|
||||||
botCluster->on_voice_track_marker([&](const dpp::voice_track_marker_t &marker)
|
botCluster->on_voice_track_marker([&](const dpp::voice_track_marker_t &marker)
|
||||||
{
|
{
|
||||||
@@ -39,11 +39,10 @@ BumbleCeepp::BumbleCeepp(std::string token, std::string DBURL, std::string DBID,
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
marker.voice_client->log(dpp::loglevel::ll_debug, "Playing " + marker.track_meta + "on channel id " + marker.voice_client->channel_id.str() + ".");
|
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();
|
int remainingSongsCount = marker.voice_client->get_tracks_remaining();
|
||||||
marker.voice_client->log(dpp::loglevel::ll_debug, "Marker count : " + remainingSongsCount);
|
marker.voice_client->log(dpp::loglevel::ll_debug, "Marker count : " + std::to_string(remainingSongsCount));
|
||||||
|
|
||||||
if (remainingSongsCount <= 1 && !marker.voice_client->is_playing())
|
if (remainingSongsCount <= 1 && !marker.voice_client->is_playing())
|
||||||
{
|
{
|
||||||
@@ -51,9 +50,16 @@ BumbleCeepp::BumbleCeepp(std::string token, std::string DBURL, std::string DBID,
|
|||||||
std::cout << "Queue ended\n";
|
std::cout << "Queue ended\n";
|
||||||
if (!joinedShard)
|
if (!joinedShard)
|
||||||
return;
|
return;
|
||||||
marker.voice_client->stop_audio();
|
|
||||||
joinedShard->disconnect_voice(marker.voice_client->server_id);
|
if (repeat) {
|
||||||
return;
|
std::shared_ptr<dpp::embed> embed = findEmbed(nowPlayingMusic);
|
||||||
|
enqueueMusic({nowPlayingMusic, *embed}, marker.voice_client);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
marker.voice_client->stop_audio();
|
||||||
|
joinedShard->disconnect_voice(marker.voice_client->server_id);
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (repeat) {
|
if (repeat) {
|
||||||
@@ -61,21 +67,19 @@ BumbleCeepp::BumbleCeepp(std::string token, std::string DBURL, std::string DBID,
|
|||||||
if (nowPlayingMusic == "") {
|
if (nowPlayingMusic == "") {
|
||||||
nowPlayingMusic = marker.track_meta;
|
nowPlayingMusic = marker.track_meta;
|
||||||
}
|
}
|
||||||
embed = findEmbed(nowPlayingMusic);
|
else {
|
||||||
nowPlayingMusic = marker.track_meta;
|
embed = findEmbed(nowPlayingMusic);
|
||||||
|
nowPlayingMusic = marker.track_meta;
|
||||||
|
|
||||||
if (!embed) {
|
if (!embed) {
|
||||||
botCluster->log(dpp::loglevel::ll_error, std::string("알 수 없는 오류 발생!"));
|
botCluster->log(dpp::loglevel::ll_error, std::string("알 수 없는 오류 발생!"));
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
enqueueMusic({nowPlayingMusic, *embed}, marker.voice_client);
|
||||||
}
|
}
|
||||||
|
|
||||||
enqueueMusic({nowPlayingMusic, *embed}, marker.voice_client);
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// cluster->on_voice_ready([&](const dpp::voice_ready_t& Voice){ queue->play(); });
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
BumbleCeepp::~BumbleCeepp()
|
BumbleCeepp::~BumbleCeepp()
|
||||||
|
|||||||
@@ -140,8 +140,8 @@ void commands::Play::on_DLCompleted(std::string musicID, dpp::embed embed, const
|
|||||||
auto voiceconn = event.from->get_voice(event.command.guild_id);
|
auto voiceconn = event.from->get_voice(event.command.guild_id);
|
||||||
|
|
||||||
if (!voiceconn || !voiceconn->voiceclient || !voiceconn->voiceclient->is_ready()) {
|
if (!voiceconn || !voiceconn->voiceclient || !voiceconn->voiceclient->is_ready()) {
|
||||||
event.from->creator->on_voice_ready([this, musicID, embed, voiceconn](const dpp::voice_ready_t& Voice){
|
event.from->creator->on_voice_ready([this, musicID, embed](const dpp::voice_ready_t& Voice){
|
||||||
this->Bot->enqueueMusic({musicID, embed}, voiceconn->voiceclient);
|
this->Bot->enqueueMusic({musicID, embed}, Voice.voice_client);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|||||||
@@ -15,7 +15,12 @@ void commands::Queue::operator()(const dpp::slashcommand_t& event) {
|
|||||||
dpp::message msg;
|
dpp::message msg;
|
||||||
msg.set_channel_id(event.command.channel_id);
|
msg.set_channel_id(event.command.channel_id);
|
||||||
|
|
||||||
auto vc = event.from->connecting_voice_channels.find(event.command.guild_id)->second->voiceclient;
|
auto voiceconn = event.from->get_voice(event.command.guild_id);
|
||||||
|
|
||||||
|
if (!voiceconn || !voiceconn->voiceclient)
|
||||||
|
event.reply("음성 채팅방에 참가하지 않은 상태입니다.");
|
||||||
|
return;
|
||||||
|
auto vc = voiceconn->voiceclient;
|
||||||
std::vector<std::string> queuedSongs = vc->get_marker_metadata();
|
std::vector<std::string> queuedSongs = vc->get_marker_metadata();
|
||||||
|
|
||||||
int remainingSongsCount = vc->get_tracks_remaining() - 1;
|
int remainingSongsCount = vc->get_tracks_remaining() - 1;
|
||||||
|
|||||||
@@ -16,6 +16,10 @@ def uri_validator(x):
|
|||||||
if uri_validator(sys.argv[1]) == True:
|
if uri_validator(sys.argv[1]) == True:
|
||||||
result = urllib.parse.urlparse(sys.argv[1])
|
result = urllib.parse.urlparse(sys.argv[1])
|
||||||
|
|
||||||
|
#youtu.be짧은 주소인 경우
|
||||||
|
if (result.netloc == 'youtu.be'):
|
||||||
|
print(result.path[1:13])
|
||||||
|
|
||||||
#플레이리스트인 경우
|
#플레이리스트인 경우
|
||||||
if result.path == '/playlist':
|
if result.path == '/playlist':
|
||||||
import re, requests
|
import re, requests
|
||||||
@@ -24,8 +28,19 @@ if uri_validator(sys.argv[1]) == True:
|
|||||||
|
|
||||||
pattern = re.compile('"videoId":"(.{11})"')
|
pattern = re.compile('"videoId":"(.{11})"')
|
||||||
|
|
||||||
list = set(pattern.findall(response.text))
|
IDlist = set(pattern.findall(response.text))
|
||||||
for it in list:
|
|
||||||
|
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
|
||||||
|
|
||||||
|
for it in list_to_return:
|
||||||
print(it)
|
print(it)
|
||||||
#영상인 경우
|
#영상인 경우
|
||||||
elif result.path == '/watch':
|
elif result.path == '/watch':
|
||||||
|
|||||||
Reference in New Issue
Block a user