基本上斜杠命令是用来播放音乐视频在打扰。播放大约30秒完全停止了,即使当我检查队列时,它显示他仍在播放音乐。在我的终端或任何相关的日志中没有得到任何错误。
我不知道该送什么,所以请告诉我
index.js
const distube = require("distube")
const Distube = new distube.DisTube(Client, {
emitNewSongOnly: true,
leaveOnStop:false,
leaveOnFinish: false,
updateYouTubeDL: true,
nsfw: true,
plugins:[new SpotifyPlugin()],
youtubeCookie:"COOKIE"
})
play.js
module.exports = {
data:{name:"play",description:"Play music",options:[{name:"query",description:"Get song name",type:"STRING",required:true}]},
async execute(utils,Client,i,Discord,userModel,serverModel,banModel,Distube){
if(!i.member.voice.channel)return i.reply({content:'Please join a voice channel',ephemeral:true})
if(!i.guild.members.me.voice.channel == i.member.voice.channel)return i.reply({content:'We are not in the same voice channel',ephemeral:true})
const song = i.options.getString("query")
Distube.play(i.member.voice.channel, song, {member:i.member,textChannel:i.channel})
i.reply({content:"Starting...",ephemeral:true})
}
}
addSong.js
const {Distube} = require("../index")
const Discord = require("discord.js")
const utils = require("../utils/utils")
Distube.on("addSong", (queue,song) => {
queue.textChannel.send({
embeds:[
new Discord.MessageEmbed()
.setAuthor({name:`Added by ${song.user.username}`,iconURL:song.user.avatarURL()})
.setTitle(song.name)
.setThumbnail(song.thumbnail)
.setURL(song.url)
.addFields([
{
name: '**Likes | Views**',
value: `**${utils.roundNumber(song.likes)} | ${utils.roundNumber(song.views)}**`,
inline: true
},
{
name:"**Duration | Position**",
value:`**${song.formattedDuration} | ${queue.songs.length}**`,
inline: true
}
])
.setFooter({text:`Volume: ${queue.volume}% | Loop: ${queue.repeatMode ? queue.repeatMode == 2 ? "All Queue" : "This Song" : "Off"}`})
]
})
})
Discord.js 13.15.03.3.4 Distube节点18.14.2
修复此问题更新到最新版本的distube
这似乎是一个node_module版本问题,可能与打扰/声音?不需要指定。请看看我的包版本,这是完美的工作。
"dependencies": {
"@discordjs/opus": "^0.8.0",
"@distube/soundcloud": "^1.2.1",
"@distube/spotify": "^1.5.1",
"@distube/yt-dlp": "^1.1.3",
"discord.js": "^14.0.3",
"distube": "^4.0.4",
"dotenv": "10.0.0",
"ffmpeg-static": "^4.4.1",
"libsodium-wrappers": "^0.7.10"
}