【发布时间】:2020-09-08 13:40:28
【问题描述】:
这是我的代码:https://hatebin.com/ljqngujsqq
我得到这个错误:
TypeError: message.client.guilds.get is not a function
【问题讨论】:
标签: javascript node.js discord discord.js chatbot
这是我的代码:https://hatebin.com/ljqngujsqq
我得到这个错误:
TypeError: message.client.guilds.get is not a function
【问题讨论】:
标签: javascript node.js discord discord.js chatbot
您的代码不起作用,因为您没有使用最新版本的 discord.js 所需的代码。您可以坚持使用 discord.js@v11,该代码可以在其中工作,也可以使用 discord.js@v12,您需要在其中执行以下操作:
message.client.guilds.cache.get('Guild ID')
欲了解更多信息,请参阅GuildManager#cache
【讨论】:
GuildManager#cache没有返回一个Promise,所以你不能使用.then