node.js - 我无法在 discord.js 中获得公会名称
问题描述
公会名我查不出来 奇怪的是代码在其他文件中运行良好,我不知道问题出在哪里。请帮忙!PS。player.guild
工作正常。我用 console.log 对其进行了测试,它返回了公会 ID,所以我不知道问题所在。PSS。我正在使用 discord.js v12 代码:
const gd = bot.guilds.cache.get(player.guild).name
console.log(gd)
错误是:
TypeError: Cannot read property 'name' of undefined
解决方案
推荐阅读
- r - 如何对 R 中列表长度不等的数据进行抽样和随机排列测试?
- image - 在谷歌表格单元格中拖放图像
- angular - Openshift Online 无法构建 Angular 应用程序,内存不足
- android - 如何在重新启动 Activity 后检查线程是否处于活动状态?
- c++ - 如何不多次使用一个元素?
- postgresql - 在匹配列上连接两个 sql 表
- python - 如何打印我想要的结果?
- php - 获取子菜单项和回显
- python - 仅将列表的有效字符串表示解析为列表
- python - FileDoesNotExistException:文件“basic.cfg”不存在。加载 VizDoom 时出现错误