0
我正在制作一个可以播放音乐的Discord机器人,我已经可以工作,但它只能播放歌曲,而当您将机器人链接到另一首歌曲而不是等待第一首歌曲结束时,它会将取消第一首歌,直接进入第二首。我正在使用discord.js,并且已将我的代码放入GitHub中。这里是我的代码:`如何让我的不和谐音乐机器人有一个音乐队列?
if(command === '!music') {
var link = arg1
console.log(link)
const ytdl = require('ytdl-core');
const streamOptions = { seek: 0, volume: 1 };
const broadcast = bot.createVoiceBroadcast();
if(link === undefined) {
bot.guilds.get(guildid).channels.get(generalchan).send("You need to put a link after !music to put a song in the queue")
} else {
if (message.member.voiceChannel) {
message.member.voiceChannel.join()
.then(connection => { // Connection is an instance of VoiceConnection
message.reply('SONG : ' + link);
const streamOptions = { seek: 0, volume: arg2/100, filter : "audioonly" };
connection.playStream(ytdl(link), streamOptions);
})
} else {
message.reply("You need to be in a voice channel for me to join")
}
}
}'
我也想投上一票帮助跳过功能,使人们可以投票跳过当前正在播放一首歌曲,并转到下一首歌曲。
您可以在问题中包含代码吗? – guest271314
我只是做了,希望你能帮助我 – kittrz