首页 > 解决方案 > voiceStateUpdate 事件不做任何事情

问题描述

自 discord.js 的 v13 更新以来我遇到了一个问题。我可以记录通道(oldState、newState),但代码没有执行并且没有返回错误!

这是我的代码:

client.on('voiceStateUpdate', async (oldState, newState) => {

    console.log(oldState) //I got the channel on the console
 
    //But the lines below not work at all since the v13 update
    if(oldState.channelID == '825407723129536543') {
        console.log(`old state is > ${oldState.channelID}`)

        if(oldState.channel.members.size == 0) {
            oldChannel = client.channels.cache.find(c => c.name == "test")
            client.channels.cache.find(c => c.name == "test").clone(undefined, true, false, 'Needed a clone')
            .then(oldChannel.delete())
        }
    }
});

标签: javascriptnode.jseventsdiscorddiscord.js

解决方案


推荐阅读