mirror of
https://github.com/ION606/selmerBot.git
synced 2026-05-14 21:26:54 +00:00
Fixed a bug with the audio player and added the 'youtubeNotifs file
This commit is contained in:
@@ -160,18 +160,18 @@ function playNext(interaction, bot, message = null) {
|
|||||||
|
|
||||||
//Setup data[1] = {info: yt_info, resource: resource}
|
//Setup data[1] = {info: yt_info, resource: resource}
|
||||||
var guildId;
|
var guildId;
|
||||||
if (message) { guildId = message.guild.id; }
|
if (message != null) { guildId = message.guild.id; }
|
||||||
else { interaction.guildId; }
|
else { guildId = interaction.guildId; }
|
||||||
|
|
||||||
let data = bot.audioData.get(guildId);
|
let data = bot.audioData.get(guildId);
|
||||||
const player = data[0];
|
const player = data[0];
|
||||||
|
|
||||||
//Check if the queue is empty
|
//Check if the queue is empty
|
||||||
if (!data[1][0]) {
|
if (data[1].length <= 0) {
|
||||||
player.stop();
|
player.stop();
|
||||||
bot.audioData.delete(guildId);
|
bot.audioData.delete(guildId);
|
||||||
if (message) { return true; }
|
if (message) { return true; }
|
||||||
else { playStopEmbed(bot, interaction, null, true); }
|
else { return playStopEmbed(bot, interaction, null, true); }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -435,13 +435,13 @@ module.exports = {
|
|||||||
if (data && data[1]) {
|
if (data && data[1]) {
|
||||||
//[player, [queue Array]]
|
//[player, [queue Array]]
|
||||||
data[1].push({yt_info: yt_info, resource: resource});
|
data[1].push({yt_info: yt_info, resource: resource});
|
||||||
bot.audioData.set(channel.guild.id, data);
|
bot.audioData.set(message.guild.id, data);
|
||||||
message.reply(`_"${yt_info.video_details.title}" added to queue!_`);
|
message.reply(`_"${yt_info.video_details.title}" added to queue!_`);
|
||||||
} else {
|
} else {
|
||||||
const player = createAudioPlayer();
|
const player = createAudioPlayer();
|
||||||
connection.subscribe(player);
|
connection.subscribe(player);
|
||||||
|
|
||||||
bot.audioData.set(channel.guild.id, [player, new Array(), null]);
|
bot.audioData.set(message.guild.id, [player, new Array(), null]);
|
||||||
player.play(resource);
|
player.play(resource);
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1 @@
|
|||||||
|
//TODO -- Maybe use https://console.cloud.google.com/apis/api/youtube.googleapis.com
|
||||||
Reference in New Issue
Block a user