我制作了一个音乐机器人,但我希望将其转化为交互,但我在调用播放函数时遇到了问题。
使用“消息”它可以工作,但使用“交互”它不会。我试图传递一些信息,我搜索但我不能。
我什至找到了另一种方法,但它没有用。
返回的错误是这样的:
DisTubeError [INVALID_TYPE]: Expected 'Discord.Message' for 'message', but got undefined (undefined)
Play.js
const { SlashCommandBuilder } = require('@discordjs/builders');
module.exports = {
data: new SlashCommandBuilder()
.setName('play')
.setDescription('Play a song!')
.addStringOption(option => option.setName('song').setDescription('Enter name of the music.')),
async execute (interaction, client){
// if(!interaction.member.voice.channel) return interaction.reply("Please, join a voice channel!");
const music = interaction.options.getString('song');
if(!music) return interaction.reply("Please, provide a song!");
await client.distube.play(interaction, music);
// await client.distube.playVoiceChannel(
// interaction.member.voice.channel,
// music,
// {
// textChannel: interaction.channel,
// member: interaction.member
// }
// );
}
}