Reputation: 1
I'm working on a Discord bot using discord.js. And I want him to play MP3 when I type !play. But I have an error message "message.guild.channels.filter". I'm noob in this domain and I don't understand why. The code :
module.exports = class Play extends Command {
static match(message) {
return message.content.startsWith('!play')
}
static action (message){
let voiceChannel = message.guild.channels
.filter(function (channel) {return channel.type === 'voice'})
.first()
voiceChannel
.join()
.then(function (connection){
connection.playFile('./ah.mp3')
})
}
}
Upvotes: 0
Views: 2501