简体   繁体   English

Discord.js 我的机器人在 Heroku 上托管时找不到任何父频道或子频道

[英]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.

相关问题 Discord 机器人无法断开与 discord.js 中的语音通道的连接 - The Discord Bot Can't Disconnect To The Voice Channel in discord.js Discord.js:当有人进入任何频道时,我如何让我的机器人播放音频 - Discord.js : How do i make my bot play an audio when someones enter any channel Discord.js bot 无法将消息发送到特定通道 - Discord.js bot can't send message to specific channel 找不到 Discord 机器人的模块“discord.js” - Can't find module 'discord.js' for Discord bot 如何正确地将实时数据库连接到由 heroku 托管的 Discord.js 机器人 - How can I properly connect Realtime Database to a Discord.js bot hosted by heroku 当机器人托管在 heroku 上时,如何制作 discord.js 图像搜索命令 - How to make a discord.js image search command when the bot is hosted on heroku 为什么我的机器人无法获取频道? 不和谐.js - Why can't my bot get channels? discord.js 我可以将 discord 机器人的控制台日志打印到 discord.js 中的特定通道吗? - Can I print the console log of my discord bot into a specific channel in discord.js? Discord bot可以很好地在本地托管,但是如果我尝试将其托管在heroku上,它会显示“错误:找不到模块'discord.js'” - Discord bot works fine hosted locally but if i try and host it on heroku it says “Error: Cannot find module 'discord.js'” 如何找到机器人在特定频道中发送的消息? [discord.js] - How can I find a message send in a specific Channel from the bot? [discord.js]
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM