如何通过 ID 获取特定服务器? [discord.js]
How do I fetch a specific server by it's ID? [discord.js]
这是我的代码:https://hatebin.com/ljqngujsqq
我收到这个错误:
TypeError: message.client.guilds.get is not a function
您的代码无法正常工作,因为您没有使用最新版本 discord.js 所需的代码。您可以坚持使用 discord.js@v11,该代码将在其中运行,或者使用 discord.js@v12,您需要在其中执行此操作:
message.client.guilds.cache.get('Guild ID')
有关详细信息,请参阅 GuildManager#cache
这是我的代码:https://hatebin.com/ljqngujsqq
我收到这个错误:
TypeError: message.client.guilds.get is not a function
您的代码无法正常工作,因为您没有使用最新版本 discord.js 所需的代码。您可以坚持使用 discord.js@v11,该代码将在其中运行,或者使用 discord.js@v12,您需要在其中执行此操作:
message.client.guilds.cache.get('Guild ID')
有关详细信息,请参阅 GuildManager#cache