[英]Discord.js My bot can't find any parent or children channel when hosted on Heroku
Ok so i'm using Discord.js v12.4, and basically one command includes a 'category.children.forEach(...)', and it works fine locally.好的,所以我使用的是 Discord.js v12.4,基本上一个命令包括一个“category.children.forEach(...)”,它在本地运行良好。 But when it's online, category.children returns an empty collection, and no channel has a parent, always null.
但是当它在线时,category.children 返回一个空集合,并且没有频道有父级,始终为空。
I did a 'guild.channels.cache.forEach(channel => console.log(channel.parent));'我做了一个'guild.channels.cache.forEach(channel => console.log(channel.parent));' to check, and always null, null, null... Same with children...
检查,并且始终为空,空,空...与儿童相同...
Why would Heroku got trouble with children and parent channels ?为什么 Heroku 会遇到孩子和家长频道的问题?
The original part of script ( works locally ) :脚本的原始部分(在本地工作):
let channels = [];
let v_channels = [];
modelCategory.children.forEach((channel) => {
if(channel.type === "voice") v_channels[channel.position] = channel;
else channels[channel.position] = channel;
});
channels = channels.concat(v_channels);
console.log(channels);
But when the bot is hosted online :但是当机器人在线托管时:
>> []
快速更新:我也无法在本地获得父级和频道。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.