Discord Bot having trouble with basic discordjs commands (as .get() on a Role object)

Hi there !

First of all, I’m just a newbie here on Glitch so please don’t judge if ever I missed an obvious fix :pensive:
Let’s talk about my problem now ^^ I made a bot assigning/removing roles on specific message reaction and it is working well whenever I run it on my computer, but while trying to having it run on Glitch I’m being served with TypeError: serverDamnedWolves.roles.get is not a function in this code (where roleID is passed as parameter in the function containing the following line):
const role = serverDamnedWolves.roles.get(roleID);.
For information, serverDamnedWolves is defined like this:
const serverDamnedWolves = client.guilds.resolve(client.DamnedWolvesServerID);

I’ve been looking for answers on the support before posting, actually I took a look at Discord bot role functions do not work but unfortunately there is no solution in here.

Any help would be highly appreciated, thanks a lot !

Have you googled it. Because I see your issue. Client.serverDamedWolves is not a thing. :P

If you’ve recently updated Discord.JS, you should take a look at the newest docs for stable, because last Sunday, v12 was pushed to stable, and a bunch of breaking changes along with it.

I believe you want serverDamnedWolves.roles.cache.get(roleID);, just make sure it’s in cache.

Oh yes I googled it, it’s pretty rare I post on forums, I’m more the guy who spends hours on stackoverflow ans others x)
Well, I never use Client.serverDamnedWolves … ?

Actually I’m using V12 on purpose, that’s the case on my machine too, and … Damn, I was going back on the documentation to link the get() method but found cache and no trace of a get() :sweat_smile:.

Thank you for your answer, this should indeed fix my problem !

Uh-oh … Now I wonder why is my code working on my machine o_.

Well, obviously I’m having a whole bunch of errors, since I never used this cache thing before, and I used a_member.roles.something() quite a lot … But I can’t figure out why is my code still working while running on my computer ! Any clue ?