暂停命令中的TypeError

时间:2018-12-03 23:47:28

标签: node.js discord.js commando

我将所有命令从原始bot转移到由commando支持的bot上,但是由于某种原因,我继续获得TypeError: Cannot read property 'get' of undefined

run(msg, ops) {
    let fetched = ops.active.get(msg.guild.id);

    const nonePlaying = new RichEmbed()
    .setColor(0xde2e43)
    .setTitle(':no_entry: No Music Playing')
    .setDescription('There currently isn\'t any music playing in this guild!')

    if (!fetched) return msg.channel.send(nonePlaying)

    const noChannel = new RichEmbed()
    .setColor(0xde2e43)
    .setTitle(':no_entry: Wrong Channel')
    .setDescription('You must be in the same channel as the bot to skip a song.')

    if (msg.member.voiceChannel !== msg.guild.me.voiceChannel) return msg.say(noChannel)

    const paused = new RichEmbed()
    .setColor(0xde2e43)
    .setTitle(':no_entry: Error')
    .setDescription('This music is already paused.')

    if (fetched.dispatcher.paused) return msg.channel.send(paused)

    fetched.dispatcher.pause();

    const pause = new RichEmbed()
    .setColor(0x36393f)
    .setTitle(':pause_button: Paused')
    .setDescription(`Successfully paused ${fetched.queue[0].songTitle}`)

    if (fetched.dispatcher.paused) return msg.channel.send(pause)
}

这是我当前正在使用的代码,它适用于当前的bot,但不适用于我正在编码的新机器人。

0 个答案:

没有答案