我在discord 机器人中处理channelDelete 事件。我的初衷是做以下事情:
我通常可以通过除此事件期间之外的其他任何地方CategoryChannel调用的属性访问 a 下的通道...children
module.exports = {
name: 'channelDelete',
once: false,
async execute(channel) {
if(channel.type == 'GUILD_CATEGORY')
for(let [child_id, child] of channel.children)
if (child.deletable) child.delete();
},
}
Run Code Online (Sandbox Code Playgroud)
我可以确认代码正在执行,但问题是传入的通道对象处于已删除的状态,并且我无法获取子对象:
deleted: truechildren属性为空,即使我知道在删除之前该频道类别中存在频道CategoryChannel有没有办法让我的机器人在删除之前收集和处理 a 的子项?