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