【发布时间】:2020-08-05 13:50:09
【问题描述】:
我正在使用 discord.js 开发 Discord 机器人。我希望他在我输入 !play 时播放 MP3。 但我有一条错误消息“message.guild.channels.filter”。我是这个领域的菜鸟,我不明白为什么。代码:
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')
})
}
}
【问题讨论】:
标签: javascript bots discord discord.js