MyriadSloths
MyriadSloths

Reputation: 13

Discord.js - bot.guilds.get is not a function?

I made a discord bot in discord.js about a year ago and wanted to do some new things with it today, so I went back to it. It worked fine before for a long time, but now on the line server = bot.guilds.get(serverID); is gives me the error 'bot.guilds.get is not a function' when it should be. What am I doing wrong?

Upvotes: 1

Views: 769

Answers (1)

Jakye
Jakye

Reputation: 6645

I'm assuming you're getting the error because you're using Discord.js V12 and your bot was made for Discord.js V11.

The solution to this problem is to use:

bot.guilds.cache.get("GuildID")

instead of:

bot.guilds.get("GuildID")

https://discord.js.org/#/docs/main/stable/class/GuildManager?scrollTo=cache

Upvotes: 2

Related Questions